home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / QuickTimeMusic.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  86.5 KB  |  2,126 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        QuickTimeMusic.h
  3.  
  4.      Contains:    QuickTime interfaces
  5.  
  6.      Version:    Technology:    
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1990-1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __QUICKTIMEMUSIC__
  18. #define __QUICKTIMEMUSIC__
  19.  
  20. #ifndef __COMPONENTS__
  21.     #include <Components.h>
  22. #endif
  23.  
  24. #ifndef __IMAGECOMPRESSION__
  25.     #include <ImageCompression.h>
  26. #endif
  27.  
  28. #ifndef __MOVIES__
  29.     #include <Movies.h>
  30. #endif
  31.  
  32. #ifndef __QUICKDRAW__
  33.     #include <Quickdraw.h>
  34. #endif
  35.  
  36. #ifndef __VIDEO__
  37.     #include <Video.h>
  38. #endif
  39.  
  40. #ifndef __MACMEMORY__
  41.     #include <MacMemory.h>
  42. #endif
  43.  
  44. #ifndef __SOUND__
  45.     #include <Sound.h>
  46. #endif
  47.  
  48. #ifndef __ENDIAN__
  49.     #include <Endian.h>
  50. #endif
  51.  
  52.  
  53.  
  54.  
  55. #if PRAGMA_ONCE
  56. #pragma once
  57. #endif
  58.  
  59. #ifdef __cplusplus
  60. extern "C" {
  61. #endif
  62.  
  63. #if PRAGMA_IMPORT
  64. #pragma import on
  65. #endif
  66.  
  67. #if PRAGMA_STRUCT_ALIGN
  68.     #pragma options align=mac68k
  69. #elif PRAGMA_STRUCT_PACKPUSH
  70.     #pragma pack(push, 2)
  71. #elif PRAGMA_STRUCT_PACK
  72.     #pragma pack(2)
  73. #endif
  74.  
  75. enum {
  76.     kaiToneDescType                = FOUR_CHAR_CODE('tone'),
  77.     kaiNoteRequestInfoType        = FOUR_CHAR_CODE('ntrq'),
  78.     kaiKnobListType                = FOUR_CHAR_CODE('knbl'),
  79.     kaiKeyRangeInfoType            = FOUR_CHAR_CODE('sinf'),
  80.     kaiSampleDescType            = FOUR_CHAR_CODE('sdsc'),
  81.     kaiSampleInfoType            = FOUR_CHAR_CODE('smin'),
  82.     kaiSampleDataType            = FOUR_CHAR_CODE('sdat'),
  83.     kaiSampleDataQUIDType        = FOUR_CHAR_CODE('quid'),
  84.     kaiInstInfoType                = FOUR_CHAR_CODE('iinf'),
  85.     kaiPictType                    = FOUR_CHAR_CODE('pict'),
  86.     kaiWriterType                = FOUR_CHAR_CODE('©wrt'),
  87.     kaiCopyrightType            = FOUR_CHAR_CODE('©cpy'),
  88.     kaiOtherStrType                = FOUR_CHAR_CODE('str '),
  89.     kaiInstrumentRefType        = FOUR_CHAR_CODE('iref'),
  90.     kaiInstGMQualityType        = FOUR_CHAR_CODE('qual'),
  91.     kaiLibraryInfoType            = FOUR_CHAR_CODE('linf'),
  92.     kaiLibraryDescType            = FOUR_CHAR_CODE('ldsc')
  93. };
  94.  
  95.  
  96. struct InstLibDescRec {
  97.     Str31                             libIDName;
  98. };
  99. typedef struct InstLibDescRec            InstLibDescRec;
  100.  
  101. struct InstKnobRec {
  102.     BigEndianLong                     number;
  103.     BigEndianLong                     value;
  104. };
  105. typedef struct InstKnobRec                InstKnobRec;
  106. enum {
  107.     kInstKnobMissingUnknown        = 0,
  108.     kInstKnobMissingDefault        = (1 << 0)
  109. };
  110.  
  111.  
  112. struct InstKnobList {
  113.     BigEndianLong                     knobCount;
  114.     BigEndianLong                     knobFlags;
  115.     InstKnobRec                     knob[1];
  116. };
  117. typedef struct InstKnobList                InstKnobList;
  118. enum {
  119.     kMusicLoopTypeNormal        = 0,
  120.     kMusicLoopTypePalindrome    = 1                                /* back & forth*/
  121. };
  122.  
  123. enum {
  124.     instSamplePreProcessFlag    = 1 << 0
  125. };
  126.  
  127.  
  128. struct InstSampleDescRec {
  129.     BigEndianOSType                 dataFormat;
  130.     BigEndianShort                     numChannels;
  131.     BigEndianShort                     sampleSize;
  132.     BigEndianUnsignedFixed             sampleRate;
  133.     BigEndianShort                     sampleDataID;
  134.     BigEndianLong                     offset;                        /* offset within SampleData - this could be just for internal use*/
  135.     BigEndianLong                     numSamples;                    /* this could also just be for internal use, we'll see*/
  136.  
  137.     BigEndianLong                     loopType;
  138.     BigEndianLong                     loopStart;
  139.     BigEndianLong                     loopEnd;
  140.  
  141.     BigEndianLong                     pitchNormal;
  142.     BigEndianLong                     pitchLow;
  143.     BigEndianLong                     pitchHigh;
  144. };
  145. typedef struct InstSampleDescRec        InstSampleDescRec;
  146.  
  147. typedef Handle                             AtomicInstrument;
  148. typedef Ptr                             AtomicInstrumentPtr;
  149. enum {
  150.     kQTMIDIComponentType        = FOUR_CHAR_CODE('midi')
  151. };
  152.  
  153. enum {
  154.     kOMSComponentSubType        = FOUR_CHAR_CODE('OMS '),
  155.     kFMSComponentSubType        = FOUR_CHAR_CODE('FMS '),
  156.     kMIDIManagerComponentSubType = FOUR_CHAR_CODE('mmgr')
  157. };
  158.  
  159. typedef ComponentInstance                 QTMIDIComponent;
  160. enum {
  161.     kMusicPacketPortLost        = 1,                            /* received when application loses the default input port */
  162.     kMusicPacketPortFound        = 2,                            /* received when application gets it back out from under someone else's claim */
  163.     kMusicPacketTimeGap            = 3                                /* data[0] = number of milliseconds to keep the MIDI line silent */
  164. };
  165.  
  166. enum {
  167.     kAppleSysexID                = 0x11,                            /* apple sysex is followed by 2-byte command. 0001 is the command for samplesize */
  168.     kAppleSysexCmdSampleSize    = 0x0001,                        /* 21 bit number in 3 midi bytes follows sysex ID and 2 cmd bytes */
  169.     kAppleSysexCmdSampleBreak    = 0x0002,                        /* specifies that the sample should break right here */
  170.     kAppleSysexCmdAtomicInstrument = 0x0010,                    /* contents of atomic instrument handle */
  171.     kAppleSysexCmdDeveloper        = 0x7F00                        /* F0 11 7F 00 ww xx yy zz ... F7 is available for non-Apple developers, where wxyz is unique app signature with 8th bit cleared, unique to developer, and 00 and 7f are reserved */
  172. };
  173.  
  174.  
  175. struct MusicMIDIPacket {
  176.     unsigned short                     length;
  177.     unsigned long                     reserved;                    /* if length zero, then reserved = above enum */
  178.     UInt8                             data[249];
  179. };
  180. typedef struct MusicMIDIPacket            MusicMIDIPacket;
  181. typedef CALLBACK_API( ComponentResult , MusicMIDISendProcPtr )(ComponentInstance self, long refCon, MusicMIDIPacket *mmp);
  182. typedef CALLBACK_API( ComponentResult , MusicMIDIReadHookProcPtr )(MusicMIDIPacket *mp, long myRefCon);
  183. typedef STACK_UPP_TYPE(MusicMIDISendProcPtr)                     MusicMIDISendUPP;
  184. typedef STACK_UPP_TYPE(MusicMIDIReadHookProcPtr)                 MusicMIDIReadHookUPP;
  185. enum {
  186.     kSynthesizerConnectionFMS    = 1,                            /* this connection imported from FMS */
  187.     kSynthesizerConnectionMMgr    = 2,                            /* this connection imported from the MIDI Mgr */
  188.     kSynthesizerConnectionOMS    = 4,                            /* this connection imported from OMS */
  189.     kSynthesizerConnectionQT    = 8,                            /* this connection is a QuickTime-only port */
  190.                                                                 /* lowest four bits are mutually exclusive; combinations reserved for future use.*/
  191.     kSynthesizerConnectionUnavailable = 256                        /* port exists, but cannot be used just now */
  192. };
  193.  
  194.  
  195. struct SynthesizerConnections {
  196.     OSType                             clientID;
  197.     OSType                             inputPortID;                /* terminology death: this port is used to SEND to the midi synth */
  198.     OSType                             outputPortID;                /* terminology death: this port receives from a keyboard or other control device */
  199.     long                             midiChannel;                /* The system channel; others are configurable (or the nubus slot number) */
  200.     long                             flags;
  201.     long                             unique;                        /* unique id may be used instead of index, to getinfo and unregister calls */
  202.     long                             reserved1;                    /* should be zero */
  203.     long                             reserved2;                    /* should be zero */
  204. };
  205. typedef struct SynthesizerConnections    SynthesizerConnections;
  206.  
  207. struct QTMIDIPort {
  208.     SynthesizerConnections             portConnections;
  209.     Str63                             portName;
  210. };
  211. typedef struct QTMIDIPort                QTMIDIPort;
  212.  
  213. struct QTMIDIPortList {
  214.     short                             portCount;
  215.     QTMIDIPort                         port[1];
  216. };
  217. typedef struct QTMIDIPortList            QTMIDIPortList;
  218. typedef QTMIDIPortList *                QTMIDIPortListPtr;
  219. typedef QTMIDIPortListPtr *                QTMIDIPortListHandle;
  220. EXTERN_API( ComponentResult )
  221. QTMIDIGetMIDIPorts                (QTMIDIComponent         ci,
  222.                                  QTMIDIPortListHandle *    inputPorts,
  223.                                  QTMIDIPortListHandle *    outputPorts)                        FIVEWORDINLINE(0x2F3C, 0x0008, 0x0001, 0x7000, 0xA82A);
  224.  
  225. EXTERN_API( ComponentResult )
  226. QTMIDIUseSendPort                (QTMIDIComponent         ci,
  227.                                  long                     portIndex,
  228.                                  long                     inUse)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0002, 0x7000, 0xA82A);
  229.  
  230. EXTERN_API( ComponentResult )
  231. QTMIDISendMIDI                    (QTMIDIComponent         ci,
  232.                                  long                     portIndex,
  233.                                  MusicMIDIPacket *        mp)                                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0003, 0x7000, 0xA82A);
  234.  
  235. EXTERN_API( ComponentResult )
  236. QTMIDIUseReceivePort            (QTMIDIComponent         ci,
  237.                                  long                     portIndex,
  238.                                  MusicMIDIReadHookUPP     readHook,
  239.                                  long                     refCon)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x0004, 0x7000, 0xA82A);
  240.  
  241.  
  242.  
  243. enum {
  244.     kMusicComponentType            = FOUR_CHAR_CODE('musi'),
  245.     kInstrumentComponentType    = FOUR_CHAR_CODE('inst')
  246. };
  247.  
  248. enum {
  249.     kSoftSynthComponentSubType    = FOUR_CHAR_CODE('ss  '),
  250.     kGMSynthComponentSubType    = FOUR_CHAR_CODE('gm  ')
  251. };
  252.  
  253.  
  254.  
  255. typedef ComponentInstance                 MusicComponent;
  256. /* MusicSynthesizerFlags*/
  257. enum {
  258.     kSynthesizerDynamicVoice    = 1 << 0,                        /* can assign voices on the fly (else, polyphony is very important */
  259.     kSynthesizerUsesMIDIPort    = 1 << 1,                        /* must be patched through MIDI Manager */
  260.     kSynthesizerMicrotone        = 1 << 2,                        /* can play microtonal scales */
  261.     kSynthesizerHasSamples        = 1 << 3,                        /* synthesizer has some use for sampled data */
  262.     kSynthesizerMixedDrums        = 1 << 4,                        /* any part can play drum parts, total = instrument parts */
  263.     kSynthesizerSoftware        = 1 << 5,                        /* implemented in main CPU software == uses cpu cycles */
  264.     kSynthesizerHardware        = 1 << 6,                        /* is a hardware device (such as nubus, or maybe DSP?) */
  265.     kSynthesizerDynamicChannel    = 1 << 7,                        /* can move any part to any channel or disable each part. (else we assume it lives on all channels in masks) */
  266.     kSynthesizerHogsSystemChannel = 1 << 8,                        /* can be channelwise dynamic, but always responds on its system channel */
  267.     kSynthesizerHasSystemChannel = 1 << 9,                        /* has some "system channel" notion to distinguish it from multiple instances of the same device (GM devices dont) */
  268.     kSynthesizerSlowSetPart        = 1 << 10,                        /* SetPart() and SetPartInstrumentNumber() calls do not have rapid response, may glitch notes */
  269.     kSynthesizerOffline            = 1 << 12,                        /* can enter an offline synthesis mode */
  270.     kSynthesizerGM                = 1 << 14,                        /* synth is a GM device */
  271.     kSynthesizerDLS                = 1 << 15,                        /* synth supports DLS level 1 */
  272.     kSynthesizerSoundLocalization = 1 << 16                        /* synth supports extremely baroque, nonstandard, and proprietary "apple game sprockets" localization parameter set */
  273. };
  274.  
  275. /*
  276.  * Note that these controller numbers
  277.  * are _not_ identical to the MIDI controller numbers.
  278.  * These are _signed_ 8.8 values, and the LSB's are
  279.  * always sent to a MIDI device. Controllers 32-63 are
  280.  * reserved (for MIDI, they are LSB's for 0-31, but we
  281.  * always send both).
  282.  *
  283.  * The full range, therefore, is -128.00 to 127.7f.
  284.  *
  285.  * _Excepting_ _volume_, all controls default to zero.
  286.  *
  287.  * Pitch bend is specified in fractional semitones! No
  288.  * more "pitch bend range" nonsense. You can bend as far
  289.  * as you want, any time you want.
  290.  */
  291. typedef SInt32                             MusicController;
  292. enum {
  293.     kControllerModulationWheel    = 1,
  294.     kControllerBreath            = 2,
  295.     kControllerFoot                = 4,
  296.     kControllerPortamentoTime    = 5,                            /* time in 8.8 seconds, portamento on/off is omitted, 0 time = 'off' */
  297.     kControllerVolume            = 7,                            /* main volume control */
  298.     kControllerBalance            = 8,
  299.     kControllerPan                = 10,                            /* 0 - "default", 1 - n: positioned in output 1-n (incl fractions) */
  300.     kControllerExpression        = 11,                            /* secondary volume control */
  301.     kControllerLever1            = 16,                            /* general purpose controllers */
  302.     kControllerLever2            = 17,                            /* general purpose controllers */
  303.     kControllerLever3            = 18,                            /* general purpose controllers */
  304.     kControllerLever4            = 19,                            /* general purpose controllers */
  305.     kControllerLever5            = 80,                            /* general purpose controllers */
  306.     kControllerLever6            = 81,                            /* general purpose controllers */
  307.     kControllerLever7            = 82,                            /* general purpose controllers */
  308.     kControllerLever8            = 83,                            /* general purpose controllers */
  309.     kControllerPitchBend        = 32,                            /* positive & negative semitones, with 8 bits fraction, same units as transpose controllers*/
  310.     kControllerAfterTouch        = 33,                            /* aka channel pressure */
  311.     kControllerPartTranspose    = 40,                            /* identical to pitchbend, for overall part xpose */
  312.     kControllerTuneTranspose    = 41,                            /* another pitchbend, for "song global" pitch offset */
  313.     kControllerPartVolume        = 42,                            /* another volume control, passed right down from note allocator part volume */
  314.     kControllerTuneVolume        = 43,                            /* another volume control, used for "song global" volume - since we share one synthesizer across multiple tuneplayers*/
  315.     kControllerSustain            = 64,                            /* boolean - positive for on, 0 or negative off */
  316.     kControllerPortamento        = 65,                            /* boolean*/
  317.     kControllerSostenuto        = 66,                            /* boolean */
  318.     kControllerSoftPedal        = 67,                            /* boolean */
  319.     kControllerReverb            = 91,
  320.     kControllerTremolo            = 92,
  321.     kControllerChorus            = 93,
  322.     kControllerCeleste            = 94,
  323.     kControllerPhaser            = 95,
  324.     kControllerEditPart            = 113,                            /* last 16 controllers 113-128 and above are global controllers which respond on part zero */
  325.     kControllerMasterTune        = 114,
  326.     kControllerMasterTranspose    = 114,                            /* preferred*/
  327.     kControllerMasterVolume        = 115,
  328.     kControllerMasterCPULoad    = 116,
  329.     kControllerMasterPolyphony    = 117,
  330.     kControllerMasterFeatures    = 118
  331. };
  332.  
  333.  
  334. /* ID's of knobs supported by the QuickTime Music Synthesizer built into QuickTime*/
  335.  
  336. enum {
  337.     kQTMSKnobStartID            = 0x02000000,
  338.     kQTMSKnobVolumeAttackTimeID    = 0x02000001,
  339.     kQTMSKnobVolumeDecayTimeID    = 0x02000002,
  340.     kQTMSKnobVolumeSustainLevelID = 0x02000003,
  341.     kQTMSKnobVolumeRelease1RateID = 0x02000004,
  342.     kQTMSKnobVolumeDecayKeyScalingID = 0x02000005,
  343.     kQTMSKnobVolumeReleaseTimeID = 0x02000006,
  344.     kQTMSKnobVolumeLFODelayID    = 0x02000007,
  345.     kQTMSKnobVolumeLFORampTimeID = 0x02000008,
  346.     kQTMSKnobVolumeLFOPeriodID    = 0x02000009,
  347.     kQTMSKnobVolumeLFOShapeID    = 0x0200000A,
  348.     kQTMSKnobVolumeLFODepthID    = 0x0200000B,
  349.     kQTMSKnobVolumeOverallID    = 0x0200000C,
  350.     kQTMSKnobVolumeVelocity127ID = 0x0200000D,
  351.     kQTMSKnobVolumeVelocity96ID    = 0x0200000E,
  352.     kQTMSKnobVolumeVelocity64ID    = 0x0200000F,
  353.     kQTMSKnobVolumeVelocity32ID    = 0x02000010,
  354.     kQTMSKnobVolumeVelocity16ID    = 0x02000011,                    /* Pitch related knobs*/
  355.     kQTMSKnobPitchTransposeID    = 0x02000012,
  356.     kQTMSKnobPitchLFODelayID    = 0x02000013,
  357.     kQTMSKnobPitchLFORampTimeID    = 0x02000014,
  358.     kQTMSKnobPitchLFOPeriodID    = 0x02000015,
  359.     kQTMSKnobPitchLFOShapeID    = 0x02000016,
  360.     kQTMSKnobPitchLFODepthID    = 0x02000017,
  361.     kQTMSKnobPitchLFOQuantizeID    = 0x02000018,                    /* Stereo related knobs*/
  362.     kQTMSKnobStereoDefaultPanID    = 0x02000019,
  363.     kQTMSKnobStereoPositionKeyScalingID = 0x0200001A,
  364.     kQTMSKnobPitchLFOOffsetID    = 0x0200001B,
  365.     kQTMSKnobExclusionGroupID    = 0x0200001C,                    /* Misc knobs, late additions*/
  366.     kQTMSKnobSustainTimeID        = 0x0200001D,
  367.     kQTMSKnobSustainInfiniteID    = 0x0200001E,
  368.     kQTMSKnobVolumeLFOStereoID    = 0x0200001F,
  369.     kQTMSKnobVelocityLowID        = 0x02000020,
  370.     kQTMSKnobVelocityHighID        = 0x02000021,
  371.     kQTMSKnobVelocitySensitivityID = 0x02000022,
  372.     kQTMSKnobPitchSensitivityID    = 0x02000023,
  373.     kQTMSKnobVolumeLFODepthFromWheelID = 0x02000024,
  374.     kQTMSKnobPitchLFODepthFromWheelID = 0x02000025,                /* Volume Env again*/
  375.     kQTMSKnobVolumeExpOptionsID    = 0x02000026,                    /* Env1*/
  376.     kQTMSKnobEnv1AttackTimeID    = 0x02000027,
  377.     kQTMSKnobEnv1DecayTimeID    = 0x02000028,
  378.     kQTMSKnobEnv1SustainLevelID    = 0x02000029,
  379.     kQTMSKnobEnv1SustainTimeID    = 0x0200002A,
  380.     kQTMSKnobEnv1SustainInfiniteID = 0x0200002B,
  381.     kQTMSKnobEnv1ReleaseTimeID    = 0x0200002C,
  382.     kQTMSKnobEnv1ExpOptionsID    = 0x0200002D,                    /* Env2*/
  383.     kQTMSKnobEnv2AttackTimeID    = 0x0200002E,
  384.     kQTMSKnobEnv2DecayTimeID    = 0x0200002F,
  385.     kQTMSKnobEnv2SustainLevelID    = 0x02000030,
  386.     kQTMSKnobEnv2SustainTimeID    = 0x02000031,
  387.     kQTMSKnobEnv2SustainInfiniteID = 0x02000032,
  388.     kQTMSKnobEnv2ReleaseTimeID    = 0x02000033,
  389.     kQTMSKnobEnv2ExpOptionsID    = 0x02000034,                    /* Pitch Env*/
  390.     kQTMSKnobPitchEnvelopeID    = 0x02000035,
  391.     kQTMSKnobPitchEnvelopeDepthID = 0x02000036,                    /* Filter*/
  392.     kQTMSKnobFilterKeyFollowID    = 0x02000037,
  393.     kQTMSKnobFilterTransposeID    = 0x02000038,
  394.     kQTMSKnobFilterQID            = 0x02000039,
  395.     kQTMSKnobFilterFrequencyEnvelopeID = 0x0200003A,
  396.     kQTMSKnobFilterFrequencyEnvelopeDepthID = 0x0200003B,
  397.     kQTMSKnobFilterQEnvelopeID    = 0x0200003C,
  398.     kQTMSKnobFilterQEnvelopeDepthID = 0x0200003D,                /* Reverb Threshhold*/
  399.     kQTMSKnobReverbThresholdID    = 0x0200003E,
  400.     kQTMSKnobVolumeAttackVelScalingID = 0x0200003F,
  401.     kQTMSKnobLastIDPlus1        = 0x02000040
  402. };
  403.  
  404.  
  405.  
  406.  
  407. enum {
  408.     kControllerMaximum            = 0x00007FFF,                    /* +01111111.11111111 */
  409.     kControllerMinimum            = (long)0xFFFF8000                /* -10000000.00000000 */
  410. };
  411.  
  412.  
  413. struct SynthesizerDescription {
  414.     OSType                             synthesizerType;            /* synthesizer type (must be same as component subtype) */
  415.     Str31                             name;                        /* text name of synthesizer type */
  416.     unsigned long                     flags;                        /* from the above enum */
  417.     unsigned long                     voiceCount;                    /* maximum polyphony */
  418.  
  419.     unsigned long                     partCount;                    /* maximum multi-timbrality (and midi channels) */
  420.     unsigned long                     instrumentCount;            /* non gm, built in (rom) instruments only */
  421.     unsigned long                     modifiableInstrumentCount;    /* plus n-more are user modifiable */
  422.     unsigned long                     channelMask;                /* (midi device only) which channels device always uses */
  423.  
  424.     unsigned long                     drumPartCount;                /* maximum multi-timbrality of drum parts */
  425.     unsigned long                     drumCount;                    /* non gm, built in (rom) drumkits only */
  426.     unsigned long                     modifiableDrumCount;        /* plus n-more are user modifiable */
  427.     unsigned long                     drumChannelMask;            /* (midi device only) which channels device always uses */
  428.  
  429.     unsigned long                     outputCount;                /* number of audio outputs (usually two) */
  430.     unsigned long                     latency;                    /* response time in .Sec */
  431.  
  432.     unsigned long                     controllers[4];                /* array of 128 bits */
  433.     unsigned long                     gmInstruments[4];            /* array of 128 bits */
  434.     unsigned long                     gmDrums[4];                    /* array of 128 bits */
  435. };
  436. typedef struct SynthesizerDescription    SynthesizerDescription;
  437. enum {
  438.     kVoiceCountDynamic            = -1                            /* constant to use to specify dynamic voicing */
  439. };
  440.  
  441.  
  442.  
  443. struct ToneDescription {
  444.     BigEndianOSType                 synthesizerType;            /* synthesizer type */
  445.     Str31                             synthesizerName;            /* name of instantiation of synth */
  446.     Str31                             instrumentName;                /* preferred name for human use */
  447.     BigEndianLong                     instrumentNumber;            /* inst-number used if synth-name matches */
  448.     BigEndianLong                     gmNumber;                    /* Best matching general MIDI number */
  449. };
  450. typedef struct ToneDescription            ToneDescription;
  451. enum {
  452.     kFirstGMInstrument            = 0x00000001,
  453.     kLastGMInstrument            = 0x00000080,
  454.     kFirstGSInstrument            = 0x00000081,
  455.     kLastGSInstrument            = 0x00003FFF,
  456.     kFirstDrumkit                = 0x00004000,                    /* (first value is "no drum". instrument numbers from 16384->16384+128 are drumkits, and for GM they are _defined_ drumkits! */
  457.     kLastDrumkit                = 0x00004080,
  458.     kFirstROMInstrument            = 0x00008000,
  459.     kLastROMInstrument            = 0x0000FFFF,
  460.     kFirstUserInstrument        = 0x00010000,
  461.     kLastUserInstrument            = 0x0001FFFF
  462. };
  463.  
  464. /* InstrumentMatch*/
  465. enum {
  466.     kInstrumentMatchSynthesizerType = 1,
  467.     kInstrumentMatchSynthesizerName = 2,
  468.     kInstrumentMatchName        = 4,
  469.     kInstrumentMatchNumber        = 8,
  470.     kInstrumentMatchGMNumber    = 16,
  471.     kInstrumentMatchGSNumber    = 32
  472. };
  473.  
  474. /* KnobFlags*/
  475. enum {
  476.     kKnobBasic                    = 8,                            /* knob shows up in certain simplified lists of knobs */
  477.     kKnobReadOnly                = 16,                            /* knob value cannot be changed by user or with a SetKnob call */
  478.     kKnobInterruptUnsafe        = 32,                            /* only alter this knob from foreground task time (may access toolbox) */
  479.     kKnobKeyrangeOverride        = 64,                            /* knob can be overridden within a single keyrange (software synth only) */
  480.     kKnobGroupStart                = 128,                            /* knob is first in some logical group of knobs */
  481.     kKnobFixedPoint8            = 1024,
  482.     kKnobFixedPoint16            = 2048,                            /* One of these may be used at a time. */
  483.     kKnobTypeNumber                = 0 << 12,
  484.     kKnobTypeGroupName            = 1 << 12,                        /* "knob" is really a group name for display purposes */
  485.     kKnobTypeBoolean            = 2 << 12,                        /* if range is greater than 1, its a multi-checkbox field */
  486.     kKnobTypeNote                = 3 << 12,                        /* knob range is equivalent to MIDI keys */
  487.     kKnobTypePan                = 4 << 12,                        /* range goes left/right (lose this? ) */
  488.     kKnobTypeInstrument            = 5 << 12,                        /* knob value = reference to another instrument number */
  489.     kKnobTypeSetting            = 6 << 12,                        /* knob value is 1 of n different things (eg, fm algorithms) popup menu */
  490.     kKnobTypeMilliseconds        = 7 << 12,                        /* knob is a millisecond time range */
  491.     kKnobTypePercentage            = 8 << 12,                        /* knob range is displayed as a Percentage */
  492.     kKnobTypeHertz                = 9 << 12,                        /* knob represents frequency */
  493.     kKnobTypeButton                = 10 << 12                        /* momentary trigger push button */
  494. };
  495.  
  496.  
  497. enum {
  498.     kUnknownKnobValue            = 0x7FFFFFFF,                    /* a knob with this value means, we don't know it. */
  499.     kDefaultKnobValue            = 0x7FFFFFFE                    /* used to SET a knob to its default value. */
  500. };
  501.  
  502.  
  503. struct KnobDescription {
  504.     Str63                             name;
  505.     long                             lowValue;
  506.     long                             highValue;
  507.     long                             defaultValue;                /* a default instrument is made of all default values */
  508.     long                             flags;
  509.     long                             knobID;
  510. };
  511. typedef struct KnobDescription            KnobDescription;
  512.  
  513. struct GCInstrumentData {
  514.     ToneDescription                 tone;
  515.     long                             knobCount;
  516.     long                             knob[1];
  517. };
  518. typedef struct GCInstrumentData            GCInstrumentData;
  519. typedef GCInstrumentData *                GCInstrumentDataPtr;
  520. typedef GCInstrumentDataPtr *            GCInstrumentDataHandle;
  521.  
  522. struct InstrumentAboutInfo {
  523.     PicHandle                         p;
  524.     Str255                             author;
  525.     Str255                             copyright;
  526.     Str255                             other;
  527. };
  528. typedef struct InstrumentAboutInfo        InstrumentAboutInfo;
  529.  
  530. enum {
  531.     notImplementedMusicErr        = (0x80000000 | (0xFFFF & (notImplementedMusicOSErr))),
  532.     cantSendToSynthesizerErr    = (0x80000000 | (0xFFFF & (cantSendToSynthesizerOSErr))),
  533.     cantReceiveFromSynthesizerErr = (0x80000000 | (0xFFFF & (cantReceiveFromSynthesizerOSErr))),
  534.     illegalVoiceAllocationErr    = (0x80000000 | (0xFFFF & (illegalVoiceAllocationOSErr))),
  535.     illegalPartErr                = (0x80000000 | (0xFFFF & (illegalPartOSErr))),
  536.     illegalChannelErr            = (0x80000000 | (0xFFFF & (illegalChannelOSErr))),
  537.     illegalKnobErr                = (0x80000000 | (0xFFFF & (illegalKnobOSErr))),
  538.     illegalKnobValueErr            = (0x80000000 | (0xFFFF & (illegalKnobValueOSErr))),
  539.     illegalInstrumentErr        = (0x80000000 | (0xFFFF & (illegalInstrumentOSErr))),
  540.     illegalControllerErr        = (0x80000000 | (0xFFFF & (illegalControllerOSErr))),
  541.     midiManagerAbsentErr        = (0x80000000 | (0xFFFF & (midiManagerAbsentOSErr))),
  542.     synthesizerNotRespondingErr    = (0x80000000 | (0xFFFF & (synthesizerNotRespondingOSErr))),
  543.     synthesizerErr                = (0x80000000 | (0xFFFF & (synthesizerOSErr))),
  544.     illegalNoteChannelErr        = (0x80000000 | (0xFFFF & (illegalNoteChannelOSErr))),
  545.     noteChannelNotAllocatedErr    = (0x80000000 | (0xFFFF & (noteChannelNotAllocatedOSErr))),
  546.     tunePlayerFullErr            = (0x80000000 | (0xFFFF & (tunePlayerFullOSErr))),
  547.     tuneParseErr                = (0x80000000 | (0xFFFF & (tuneParseOSErr)))
  548. };
  549.  
  550. enum {
  551.     kGetAtomicInstNoExpandedSamples = 1 << 0,
  552.     kGetAtomicInstNoOriginalSamples = 1 << 1,
  553.     kGetAtomicInstNoSamples        = kGetAtomicInstNoExpandedSamples | kGetAtomicInstNoOriginalSamples,
  554.     kGetAtomicInstNoKnobList    = 1 << 2,
  555.     kGetAtomicInstNoInstrumentInfo = 1 << 3,
  556.     kGetAtomicInstOriginalKnobList = 1 << 4,
  557.     kGetAtomicInstAllKnobs        = 1 << 5                        /* return even those that are set to default*/
  558. };
  559.  
  560. /*
  561.    For non-gm instruments, instrument number of tone description == 0
  562.    If you want to speed up while running, slam the inst num with what Get instrument number returns
  563.    All missing knobs are slammed to the default value
  564. */
  565. enum {
  566.     kSetAtomicInstKeepOriginalInstrument = 1 << 0,
  567.     kSetAtomicInstShareAcrossParts = 1 << 1,                    /* inst disappears when app goes away*/
  568.     kSetAtomicInstCallerTosses    = 1 << 2,                        /* the caller isn't keeping a copy around (for NASetAtomicInstrument)*/
  569.     kSetAtomicInstCallerGuarantees = 1 << 3,                    /* the caller guarantees a copy is around*/
  570.     kSetAtomicInstInterruptSafe    = 1 << 4,                        /* dont move memory at this time (but process at next task time)*/
  571.     kSetAtomicInstDontPreprocess = 1 << 7                        /* perform no further preprocessing because either 1)you know the instrument is digitally clean, or 2) you got it from a GetPartAtomic*/
  572. };
  573.  
  574. enum {
  575.     kInstrumentNamesModifiable    = 1,
  576.     kInstrumentNamesBoth        = 2
  577. };
  578.  
  579. /*
  580.  * Structures specific to the GenericMusicComponent
  581.  */
  582.  
  583. enum {
  584.     kGenericMusicComponentSubtype = FOUR_CHAR_CODE('gene')
  585. };
  586.  
  587.  
  588. struct GenericKnobDescription {
  589.     KnobDescription                 kd;
  590.     long                             hw1;                        /* driver defined */
  591.     long                             hw2;                        /* driver defined */
  592.     long                             hw3;                        /* driver defined */
  593.     long                             settingsID;                    /* resource ID list for boolean and popup names */
  594. };
  595. typedef struct GenericKnobDescription    GenericKnobDescription;
  596.  
  597. struct GenericKnobDescriptionList {
  598.     long                             knobCount;
  599.     GenericKnobDescription             knob[1];
  600. };
  601. typedef struct GenericKnobDescriptionList GenericKnobDescriptionList;
  602. typedef GenericKnobDescriptionList *    GenericKnobDescriptionListPtr;
  603. typedef GenericKnobDescriptionListPtr *    GenericKnobDescriptionListHandle;
  604. /* knobTypes for MusicDerivedSetKnob */
  605. enum {
  606.     kGenericMusicKnob            = 1,
  607.     kGenericMusicInstrumentKnob    = 2,
  608.     kGenericMusicDrumKnob        = 3,
  609.     kGenericMusicGlobalController = 4
  610. };
  611.  
  612.  
  613.  
  614. enum {
  615.     kGenericMusicResFirst        = 0,
  616.     kGenericMusicResMiscStringList = 1,                            /* STR# 1: synth name, 2:about author,3:aboutcopyright,4:aboutother */
  617.     kGenericMusicResMiscLongList = 2,                            /* Long various params, see list below */
  618.     kGenericMusicResInstrumentList = 3,                            /* NmLs of names and shorts, categories prefixed by 'oo' */
  619.     kGenericMusicResDrumList    = 4,                            /* NmLs of names and shorts */
  620.     kGenericMusicResInstrumentKnobDescriptionList = 5,            /* Knob */
  621.     kGenericMusicResDrumKnobDescriptionList = 6,                /* Knob */
  622.     kGenericMusicResKnobDescriptionList = 7,                    /* Knob */
  623.     kGenericMusicResBitsLongList = 8,                            /* Long back to back bitmaps of controllers, gminstruments, and drums */
  624.     kGenericMusicResModifiableInstrumentHW = 9,                    /* Shrt same as the hw shorts trailing the instrument names, a shortlist */
  625.     kGenericMusicResGMTranslation = 10,                            /* Long 128 long entries, 1 for each gm inst, of local instrument numbers 1-n (not hw numbers) */
  626.     kGenericMusicResROMInstrumentData = 11,                        /* knob lists for ROM instruments, so the knob values may be known */
  627.     kGenericMusicResAboutPICT    = 12,                            /* picture for aboutlist. must be present for GetAbout call to work */
  628.     kGenericMusicResLast        = 13
  629. };
  630.  
  631. /* elements of the misc long list */
  632. enum {
  633.     kGenericMusicMiscLongFirst    = 0,
  634.     kGenericMusicMiscLongVoiceCount = 1,
  635.     kGenericMusicMiscLongPartCount = 2,
  636.     kGenericMusicMiscLongModifiableInstrumentCount = 3,
  637.     kGenericMusicMiscLongChannelMask = 4,
  638.     kGenericMusicMiscLongDrumPartCount = 5,
  639.     kGenericMusicMiscLongModifiableDrumCount = 6,
  640.     kGenericMusicMiscLongDrumChannelMask = 7,
  641.     kGenericMusicMiscLongOutputCount = 8,
  642.     kGenericMusicMiscLongLatency = 9,
  643.     kGenericMusicMiscLongFlags    = 10,
  644.     kGenericMusicMiscLongFirstGMHW = 11,                        /* number to add to locate GM main instruments */
  645.     kGenericMusicMiscLongFirstGMDrumHW = 12,                    /* number to add to locate GM drumkits */
  646.     kGenericMusicMiscLongFirstUserHW = 13,                        /* First hw number of user instruments (presumed sequential) */
  647.     kGenericMusicMiscLongLast    = 14
  648. };
  649.  
  650.  
  651. struct GCPart {
  652.     long                             hwInstrumentNumber;            /* internal number of recalled instrument */
  653.     short                             controller[128];            /* current values for all controllers */
  654.     long                             volume;                        /* ctrl 7 is special case */
  655.     long                             polyphony;
  656.     long                             midiChannel;                /* 1-16 if in use */
  657.     GCInstrumentData                 id;                            /* ToneDescription & knoblist, uncertain length */
  658. };
  659. typedef struct GCPart                    GCPart;
  660. /*
  661.  * Calls specific to the GenericMusicComponent
  662.  */
  663. enum {
  664.     kMusicGenericRange            = 0x0100,
  665.     kMusicDerivedRange            = 0x0200
  666. };
  667.  
  668. /*
  669.  * Flags in GenericMusicConfigure call
  670.  */
  671. enum {
  672.     kGenericMusicDoMIDI            = 1 << 0,                        /* implement normal MIDI messages for note, controllers, and program changes 0-127 */
  673.     kGenericMusicBank0            = 1 << 1,                        /* implement instrument bank changes on controller 0 */
  674.     kGenericMusicBank32            = 1 << 2,                        /* implement instrument bank changes on controller 32 */
  675.     kGenericMusicErsatzMIDI        = 1 << 3,                        /* construct MIDI packets, but send them to the derived component */
  676.     kGenericMusicCallKnobs        = 1 << 4,                        /* call the derived component with special knob format call */
  677.     kGenericMusicCallParts        = 1 << 5,                        /* call the derived component with special part format call */
  678.     kGenericMusicCallInstrument    = 1 << 6,                        /* call MusicDerivedSetInstrument for MusicSetInstrument calls */
  679.     kGenericMusicCallNumber        = 1 << 7,                        /* call MusicDerivedSetPartInstrumentNumber for MusicSetPartInstrumentNumber calls, & don't send any C0 or bank stuff */
  680.     kGenericMusicCallROMInstrument = 1 << 8,                    /* call MusicSetInstrument for MusicSetPartInstrumentNumber for "ROM" instruments, passing params from the ROMi resource */
  681.     kGenericMusicAllDefaults    = 1 << 9                        /* indicates that when a new instrument is recalled, all knobs are reset to DEFAULT settings. True for GS modules */
  682. };
  683.  
  684.  
  685.  
  686.  
  687.  
  688. typedef CALLBACK_API( ComponentResult , MusicOfflineDataProcPtr )(Ptr SoundData, long numBytes, long myRefCon);
  689. typedef STACK_UPP_TYPE(MusicOfflineDataProcPtr)                 MusicOfflineDataUPP;
  690.  
  691. struct OfflineSampleType {
  692.     unsigned long                     numChannels;                /*number of channels,  ie mono = 1*/
  693.     UnsignedFixed                     sampleRate;                    /*sample rate in Apples Fixed point representation*/
  694.     unsigned short                     sampleSize;                    /*number of bits in sample*/
  695. };
  696. typedef struct OfflineSampleType        OfflineSampleType;
  697.  
  698. struct InstrumentInfoRecord {
  699.     long                             instrumentNumber;            /* instrument number (if 0, name is a catagory)*/
  700.     long                             flags;                        /* show in picker, etc.*/
  701.     long                             toneNameIndex;                /* index in toneNames (1 based)*/
  702.     long                             itxtNameAtomID;                /* index in itxtNames (itxt/name by index)*/
  703. };
  704. typedef struct InstrumentInfoRecord        InstrumentInfoRecord;
  705.  
  706. struct InstrumentInfoList {
  707.     long                             recordCount;
  708.     Handle                             toneNames;                    /* name from tone description*/
  709.     QTAtomContainer                 itxtNames;                    /* itxt/name atoms for instruments*/
  710.     InstrumentInfoRecord             info[1];
  711. };
  712. typedef struct InstrumentInfoList        InstrumentInfoList;
  713. typedef InstrumentInfoList *            InstrumentInfoListPtr;
  714. typedef InstrumentInfoListPtr *            InstrumentInfoListHandle;
  715. EXTERN_API( ComponentResult )
  716. MusicGetDescription                (MusicComponent         mc,
  717.                                  SynthesizerDescription * sd)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0001, 0x7000, 0xA82A);
  718.  
  719. EXTERN_API( ComponentResult )
  720. MusicGetPart                    (MusicComponent         mc,
  721.                                  long                     part,
  722.                                  long *                    midiChannel,
  723.                                  long *                    polyphony)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0002, 0x7000, 0xA82A);
  724.  
  725. EXTERN_API( ComponentResult )
  726. MusicSetPart                    (MusicComponent         mc,
  727.                                  long                     part,
  728.                                  long                     midiChannel,
  729.                                  long                     polyphony)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0003, 0x7000, 0xA82A);
  730.  
  731. EXTERN_API( ComponentResult )
  732. MusicSetPartInstrumentNumber    (MusicComponent         mc,
  733.                                  long                     part,
  734.                                  long                     instrumentNumber)                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0004, 0x7000, 0xA82A);
  735.  
  736. #if OLDROUTINENAMES
  737. #define MusicSetInstrumentNumber(ci,part,instrumentNumber) MusicSetPartInstrumentNumber(ci, part,instrumentNumber)
  738. #endif
  739.  
  740. EXTERN_API( ComponentResult )
  741. MusicGetPartInstrumentNumber    (MusicComponent         mc,
  742.                                  long                     part)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0005, 0x7000, 0xA82A);
  743.  
  744. EXTERN_API( ComponentResult )
  745. MusicStorePartInstrument        (MusicComponent         mc,
  746.                                  long                     part,
  747.                                  long                     instrumentNumber)                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0006, 0x7000, 0xA82A);
  748.  
  749.  
  750. EXTERN_API( ComponentResult )
  751. MusicGetPartAtomicInstrument    (MusicComponent         mc,
  752.                                  long                     part,
  753.                                  AtomicInstrument *        ai,
  754.                                  long                     flags)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x0009, 0x7000, 0xA82A);
  755.  
  756. EXTERN_API( ComponentResult )
  757. MusicSetPartAtomicInstrument    (MusicComponent         mc,
  758.                                  long                     part,
  759.                                  AtomicInstrumentPtr     aiP,
  760.                                  long                     flags)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x000A, 0x7000, 0xA82A);
  761.  
  762.  
  763. /* Obsolete calls*/
  764. EXTERN_API( ComponentResult )
  765. MusicGetInstrumentKnobDescriptionObsolete (MusicComponent  mc,
  766.                                  long                     knobIndex,
  767.                                  void *                    mkd)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x000D, 0x7000, 0xA82A);
  768.  
  769. EXTERN_API( ComponentResult )
  770. MusicGetDrumKnobDescriptionObsolete (MusicComponent     mc,
  771.                                  long                     knobIndex,
  772.                                  void *                    mkd)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x000E, 0x7000, 0xA82A);
  773.  
  774. EXTERN_API( ComponentResult )
  775. MusicGetKnobDescriptionObsolete    (MusicComponent         mc,
  776.                                  long                     knobIndex,
  777.                                  void *                    mkd)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x000F, 0x7000, 0xA82A);
  778.  
  779. EXTERN_API( ComponentResult )
  780. MusicGetPartKnob                (MusicComponent         mc,
  781.                                  long                     part,
  782.                                  long                     knobID)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0010, 0x7000, 0xA82A);
  783.  
  784. EXTERN_API( ComponentResult )
  785. MusicSetPartKnob                (MusicComponent         mc,
  786.                                  long                     part,
  787.                                  long                     knobID,
  788.                                  long                     knobValue)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0011, 0x7000, 0xA82A);
  789.  
  790. EXTERN_API( ComponentResult )
  791. MusicGetKnob                    (MusicComponent         mc,
  792.                                  long                     knobID)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0012, 0x7000, 0xA82A);
  793.  
  794. EXTERN_API( ComponentResult )
  795. MusicSetKnob                    (MusicComponent         mc,
  796.                                  long                     knobID,
  797.                                  long                     knobValue)                            FIVEWORDINLINE(0x2F3C, 0x0008, 0x0013, 0x7000, 0xA82A);
  798.  
  799. EXTERN_API( ComponentResult )
  800. MusicGetPartName                (MusicComponent         mc,
  801.                                  long                     part,
  802.                                  StringPtr                 name)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0014, 0x7000, 0xA82A);
  803.  
  804. EXTERN_API( ComponentResult )
  805. MusicSetPartName                (MusicComponent         mc,
  806.                                  long                     part,
  807.                                  StringPtr                 name)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0015, 0x7000, 0xA82A);
  808.  
  809. EXTERN_API( ComponentResult )
  810. MusicFindTone                    (MusicComponent         mc,
  811.                                  ToneDescription *        td,
  812.                                  long *                    libraryIndexOut,
  813.                                  unsigned long *        fit)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x0016, 0x7000, 0xA82A);
  814.  
  815. EXTERN_API( ComponentResult )
  816. MusicPlayNote                    (MusicComponent         mc,
  817.                                  long                     part,
  818.                                  long                     pitch,
  819.                                  long                     velocity)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0017, 0x7000, 0xA82A);
  820.  
  821. EXTERN_API( ComponentResult )
  822. MusicResetPart                    (MusicComponent         mc,
  823.                                  long                     part)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0018, 0x7000, 0xA82A);
  824.  
  825. EXTERN_API( ComponentResult )
  826. MusicSetPartController            (MusicComponent         mc,
  827.                                  long                     part,
  828.                                  MusicController         controllerNumber,
  829.                                  long                     controllerValue)                    FIVEWORDINLINE(0x2F3C, 0x000C, 0x0019, 0x7000, 0xA82A);
  830.  
  831. #if OLDROUTINENAMES
  832. #define MusicSetController(ci,part,controllerNumber,controllerValue) MusicSetPartController(ci, part,controllerNumber,controllerValue)
  833. #endif
  834.  
  835. EXTERN_API( ComponentResult )
  836. MusicGetPartController            (MusicComponent         mc,
  837.                                  long                     part,
  838.                                  MusicController         controllerNumber)                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x001A, 0x7000, 0xA82A);
  839.  
  840. EXTERN_API( ComponentResult )
  841. MusicGetMIDIProc                (MusicComponent         mc,
  842.                                  MusicMIDISendUPP *        midiSendProc,
  843.                                  long *                    refCon)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x001B, 0x7000, 0xA82A);
  844.  
  845. EXTERN_API( ComponentResult )
  846. MusicSetMIDIProc                (MusicComponent         mc,
  847.                                  MusicMIDISendUPP         midiSendProc,
  848.                                  long                     refCon)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x001C, 0x7000, 0xA82A);
  849.  
  850. EXTERN_API( ComponentResult )
  851. MusicGetInstrumentNames            (MusicComponent         mc,
  852.                                  long                     modifiableInstruments,
  853.                                  Handle *                instrumentNames,
  854.                                  Handle *                instrumentCategoryLasts,
  855.                                  Handle *                instrumentCategoryNames)            FIVEWORDINLINE(0x2F3C, 0x0010, 0x001D, 0x7000, 0xA82A);
  856.  
  857. EXTERN_API( ComponentResult )
  858. MusicGetDrumNames                (MusicComponent         mc,
  859.                                  long                     modifiableInstruments,
  860.                                  Handle *                instrumentNumbers,
  861.                                  Handle *                instrumentNames)                    FIVEWORDINLINE(0x2F3C, 0x000C, 0x001E, 0x7000, 0xA82A);
  862.  
  863. EXTERN_API( ComponentResult )
  864. MusicGetMasterTune                (MusicComponent         mc)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x001F, 0x7000, 0xA82A);
  865.  
  866. EXTERN_API( ComponentResult )
  867. MusicSetMasterTune                (MusicComponent         mc,
  868.                                  long                     masterTune)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x0020, 0x7000, 0xA82A);
  869.  
  870.  
  871. EXTERN_API( ComponentResult )
  872. MusicGetInstrumentAboutInfo        (MusicComponent         mc,
  873.                                  long                     part,
  874.                                  InstrumentAboutInfo *    iai)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0022, 0x7000, 0xA82A);
  875.  
  876. EXTERN_API( ComponentResult )
  877. MusicGetDeviceConnection        (MusicComponent         mc,
  878.                                  long                     index,
  879.                                  long *                    id1,
  880.                                  long *                    id2)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x0023, 0x7000, 0xA82A);
  881.  
  882. EXTERN_API( ComponentResult )
  883. MusicUseDeviceConnection        (MusicComponent         mc,
  884.                                  long                     id1,
  885.                                  long                     id2)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0024, 0x7000, 0xA82A);
  886.  
  887. EXTERN_API( ComponentResult )
  888. MusicGetKnobSettingStrings        (MusicComponent         mc,
  889.                                  long                     knobIndex,
  890.                                  long                     isGlobal,
  891.                                  Handle *                settingsNames,
  892.                                  Handle *                settingsCategoryLasts,
  893.                                  Handle *                settingsCategoryNames)                FIVEWORDINLINE(0x2F3C, 0x0014, 0x0025, 0x7000, 0xA82A);
  894.  
  895. EXTERN_API( ComponentResult )
  896. MusicGetMIDIPorts                (MusicComponent         mc,
  897.                                  long *                    inputPortCount,
  898.                                  long *                    outputPortCount)                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0026, 0x7000, 0xA82A);
  899.  
  900. EXTERN_API( ComponentResult )
  901. MusicSendMIDI                    (MusicComponent         mc,
  902.                                  long                     portIndex,
  903.                                  MusicMIDIPacket *        mp)                                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0027, 0x7000, 0xA82A);
  904.  
  905. EXTERN_API( ComponentResult )
  906. MusicReceiveMIDI                (MusicComponent         mc,
  907.                                  MusicMIDIReadHookUPP     readHook,
  908.                                  long                     refCon)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0028, 0x7000, 0xA82A);
  909.  
  910. EXTERN_API( ComponentResult )
  911. MusicStartOffline                (MusicComponent         mc,
  912.                                  unsigned long *        numChannels,
  913.                                  UnsignedFixed *        sampleRate,
  914.                                  unsigned short *        sampleSize,
  915.                                  MusicOfflineDataUPP     dataProc,
  916.                                  long                     dataProcRefCon)                        FIVEWORDINLINE(0x2F3C, 0x0014, 0x0029, 0x7000, 0xA82A);
  917.  
  918. EXTERN_API( ComponentResult )
  919. MusicSetOfflineTimeTo            (MusicComponent         mc,
  920.                                  long                     newTimeStamp)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x002A, 0x7000, 0xA82A);
  921.  
  922. EXTERN_API( ComponentResult )
  923. MusicGetInstrumentKnobDescription (MusicComponent         mc,
  924.                                  long                     knobIndex,
  925.                                  KnobDescription *        mkd)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x002B, 0x7000, 0xA82A);
  926.  
  927. EXTERN_API( ComponentResult )
  928. MusicGetDrumKnobDescription        (MusicComponent         mc,
  929.                                  long                     knobIndex,
  930.                                  KnobDescription *        mkd)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x002C, 0x7000, 0xA82A);
  931.  
  932. EXTERN_API( ComponentResult )
  933. MusicGetKnobDescription            (MusicComponent         mc,
  934.                                  long                     knobIndex,
  935.                                  KnobDescription *        mkd)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x002D, 0x7000, 0xA82A);
  936.  
  937. EXTERN_API( ComponentResult )
  938. MusicGetInfoText                (MusicComponent         mc,
  939.                                  long                     selector,
  940.                                  Handle *                textH,
  941.                                  Handle *                styleH)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x002E, 0x7000, 0xA82A);
  942.  
  943. enum {
  944.     kGetInstrumentInfoNoBuiltIn    = 1 << 0,
  945.     kGetInstrumentInfoMidiUserInst = 1 << 1,
  946.     kGetInstrumentInfoNoIText    = 1 << 2
  947. };
  948.  
  949. EXTERN_API( ComponentResult )
  950. MusicGetInstrumentInfo            (MusicComponent         mc,
  951.                                  long                     getInstrumentInfoFlags,
  952.                                  InstrumentInfoListHandle * infoListH)                        FIVEWORDINLINE(0x2F3C, 0x0008, 0x002F, 0x7000, 0xA82A);
  953.  
  954.  
  955.  
  956.  
  957. EXTERN_API( ComponentResult )
  958. MusicTask                        (MusicComponent         mc)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0031, 0x7000, 0xA82A);
  959.  
  960. EXTERN_API( ComponentResult )
  961. MusicSetPartInstrumentNumberInterruptSafe (MusicComponent  mc,
  962.                                  long                     part,
  963.                                  long                     instrumentNumber)                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0032, 0x7000, 0xA82A);
  964.  
  965. EXTERN_API( ComponentResult )
  966. MusicSetPartSoundLocalization    (MusicComponent         mc,
  967.                                  long                     part,
  968.                                  Handle                 data)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0033, 0x7000, 0xA82A);
  969.  
  970. EXTERN_API( ComponentResult )
  971. MusicGenericConfigure            (MusicComponent         mc,
  972.                                  long                     mode,
  973.                                  long                     flags,
  974.                                  long                     baseResID)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0100, 0x7000, 0xA82A);
  975.  
  976. EXTERN_API( ComponentResult )
  977. MusicGenericGetPart                (MusicComponent         mc,
  978.                                  long                     partNumber,
  979.                                  GCPart **                part)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0101, 0x7000, 0xA82A);
  980.  
  981. EXTERN_API( ComponentResult )
  982. MusicGenericGetKnobList            (MusicComponent         mc,
  983.                                  long                     knobType,
  984.                                  GenericKnobDescriptionListHandle * gkdlH)                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0102, 0x7000, 0xA82A);
  985.  
  986. EXTERN_API( ComponentResult )
  987. MusicGenericSetResourceNumbers    (MusicComponent         mc,
  988.                                  Handle                 resourceIDH)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x0103, 0x7000, 0xA82A);
  989.  
  990. EXTERN_API( ComponentResult )
  991. MusicDerivedMIDISend            (MusicComponent         mc,
  992.                                  MusicMIDIPacket *        packet)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0200, 0x7000, 0xA82A);
  993.  
  994. EXTERN_API( ComponentResult )
  995. MusicDerivedSetKnob                (MusicComponent         mc,
  996.                                  long                     knobType,
  997.                                  long                     knobNumber,
  998.                                  long                     knobValue,
  999.                                  long                     partNumber,
  1000.                                  GCPart *                p,
  1001.                                  GenericKnobDescription * gkd)                                FIVEWORDINLINE(0x2F3C, 0x0018, 0x0201, 0x7000, 0xA82A);
  1002.  
  1003. EXTERN_API( ComponentResult )
  1004. MusicDerivedSetPart                (MusicComponent         mc,
  1005.                                  long                     partNumber,
  1006.                                  GCPart *                p)                                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0202, 0x7000, 0xA82A);
  1007.  
  1008. EXTERN_API( ComponentResult )
  1009. MusicDerivedSetInstrument        (MusicComponent         mc,
  1010.                                  long                     partNumber,
  1011.                                  GCPart *                p)                                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0203, 0x7000, 0xA82A);
  1012.  
  1013. EXTERN_API( ComponentResult )
  1014. MusicDerivedSetPartInstrumentNumber (MusicComponent     mc,
  1015.                                  long                     partNumber,
  1016.                                  GCPart *                p)                                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0204, 0x7000, 0xA82A);
  1017.  
  1018. EXTERN_API( ComponentResult )
  1019. MusicDerivedSetMIDI                (MusicComponent         mc,
  1020.                                  MusicMIDISendUPP         midiProc,
  1021.                                  long                     refcon,
  1022.                                  long                     midiChannel)                        FIVEWORDINLINE(0x2F3C, 0x000C, 0x0205, 0x7000, 0xA82A);
  1023.  
  1024. EXTERN_API( ComponentResult )
  1025. MusicDerivedStorePartInstrument    (MusicComponent         mc,
  1026.                                  long                     partNumber,
  1027.                                  GCPart *                p,
  1028.                                  long                     instrumentNumber)                    FIVEWORDINLINE(0x2F3C, 0x000C, 0x0206, 0x7000, 0xA82A);
  1029.  
  1030. EXTERN_API( ComponentResult )
  1031. MusicDerivedOpenResFile            (MusicComponent         mc)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0207, 0x7000, 0xA82A);
  1032.  
  1033. EXTERN_API( ComponentResult )
  1034. MusicDerivedCloseResFile        (MusicComponent         mc,
  1035.                                  short                     resRefNum)                            FIVEWORDINLINE(0x2F3C, 0x0002, 0x0208, 0x7000, 0xA82A);
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042. /* Mask bit for returned value by InstrumentFind.*/
  1043. enum {
  1044.     kInstrumentExactMatch        = 0x00020000,
  1045.     kInstrumentRecommendedSubstitute = 0x00010000,
  1046.     kInstrumentQualityField        = (long)0xFF000000,
  1047.     kInstrumentRoland8BitQuality = 0x05000000
  1048. };
  1049.  
  1050.  
  1051. typedef InstrumentAboutInfo *            InstrumentAboutInfoPtr;
  1052. typedef InstrumentAboutInfoPtr *        InstrumentAboutInfoHandle;
  1053.  
  1054. struct GMInstrumentInfo {
  1055.     long                             cmpInstID;
  1056.     long                             gmInstNum;
  1057.     long                             instMatch;
  1058. };
  1059. typedef struct GMInstrumentInfo            GMInstrumentInfo;
  1060. typedef GMInstrumentInfo *                GMInstrumentInfoPtr;
  1061. typedef GMInstrumentInfoPtr *            GMInstrumentInfoHandle;
  1062.  
  1063. struct nonGMInstrumentInfoRecord {
  1064.     long                             cmpInstID;                    /* if 0, category name*/
  1065.     long                             flags;                        /* match, show in picker*/
  1066.     long                             toneNameIndex;                /* index in toneNames (1 based)*/
  1067.     long                             itxtNameAtomID;                /* index in itxtNames (itxt/name by index)*/
  1068. };
  1069. typedef struct nonGMInstrumentInfoRecord nonGMInstrumentInfoRecord;
  1070.  
  1071. struct nonGMInstrumentInfo {
  1072.     long                             recordCount;
  1073.     Handle                             toneNames;                    /* name from tone description*/
  1074.     QTAtomContainer                 itxtNames;                    /* itext/name atoms for instruments*/
  1075.     nonGMInstrumentInfoRecord         instInfo[1];
  1076. };
  1077. typedef struct nonGMInstrumentInfo        nonGMInstrumentInfo;
  1078. typedef nonGMInstrumentInfo *            nonGMInstrumentInfoPtr;
  1079. typedef nonGMInstrumentInfoPtr *        nonGMInstrumentInfoHandle;
  1080.  
  1081. struct InstCompInfo {
  1082.     long                             infoSize;                    /* size of this record*/
  1083.     Str31                             InstrumentLibraryName;
  1084.     QTAtomContainer                 InstrumentLibraryITxt;        /* itext/name atoms for instruments*/
  1085.     long                             GMinstrumentCount;
  1086.     GMInstrumentInfoHandle             GMinstrumentInfo;
  1087.     long                             GMdrumCount;
  1088.     GMInstrumentInfoHandle             GMdrumInfo;
  1089.     long                             nonGMinstrumentCount;
  1090.     nonGMInstrumentInfoHandle         nonGMinstrumentInfo;
  1091. };
  1092. typedef struct InstCompInfo                InstCompInfo;
  1093. typedef InstCompInfo *                    InstCompInfoPtr;
  1094. typedef InstCompInfoPtr *                InstCompInfoHandle;
  1095. EXTERN_API( ComponentResult )
  1096. InstrumentGetInst                (ComponentInstance         ci,
  1097.                                  long                     instID,
  1098.                                  AtomicInstrument *        atomicInst,
  1099.                                  long                     flags)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x0001, 0x7000, 0xA82A);
  1100.  
  1101. EXTERN_API( ComponentResult )
  1102. InstrumentGetInfo                (ComponentInstance         ci,
  1103.                                  long                     getInstrumentInfoFlags,
  1104.                                  InstCompInfoHandle *    instInfo)                            FIVEWORDINLINE(0x2F3C, 0x0008, 0x0002, 0x7000, 0xA82A);
  1105.  
  1106. EXTERN_API( ComponentResult )
  1107. InstrumentInitialize            (ComponentInstance         ci,
  1108.                                  long                     initFormat,
  1109.                                  void *                    initParams)                            FIVEWORDINLINE(0x2F3C, 0x0008, 0x0003, 0x7000, 0xA82A);
  1110.  
  1111. EXTERN_API( ComponentResult )
  1112. InstrumentOpenComponentResFile    (ComponentInstance         ci,
  1113.                                  short *                resFile)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x0004, 0x7000, 0xA82A);
  1114.  
  1115. EXTERN_API( ComponentResult )
  1116. InstrumentCloseComponentResFile    (ComponentInstance         ci,
  1117.                                  short                     resFile)                            FIVEWORDINLINE(0x2F3C, 0x0002, 0x0005, 0x7000, 0xA82A);
  1118.  
  1119. EXTERN_API( ComponentResult )
  1120. InstrumentGetComponentRefCon    (ComponentInstance         ci,
  1121.                                  void **                refCon)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0006, 0x7000, 0xA82A);
  1122.  
  1123. EXTERN_API( ComponentResult )
  1124. InstrumentSetComponentRefCon    (ComponentInstance         ci,
  1125.                                  void *                    refCon)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0007, 0x7000, 0xA82A);
  1126.  
  1127. EXTERN_API( ComponentResult )
  1128. InstrumentGetSynthesizerType    (ComponentInstance         ci,
  1129.                                  OSType *                synthesizerType)                    FIVEWORDINLINE(0x2F3C, 0x0004, 0x0008, 0x7000, 0xA82A);
  1130.  
  1131.  
  1132.  
  1133. /*--------------------------
  1134.     Types
  1135. --------------------------*/
  1136. enum {
  1137.     kNoteRequestNoGM            = 1,                            /* dont degrade to a GM synth */
  1138.     kNoteRequestNoSynthType        = 2,                            /* dont degrade to another synth of same type but different name */
  1139.     kNoteRequestSynthMustMatch    = 4                                /* synthType must be a match, including kGMSynthComponentSubType */
  1140. };
  1141.  
  1142.  
  1143. typedef ComponentInstance                 NoteAllocator;
  1144.  
  1145. struct NoteRequestInfo {
  1146.     UInt8                             flags;                        /* 1: dont accept GM match, 2: dont accept same-synth-type match */
  1147.     UInt8                             reserved;                    /* must be zero */
  1148.     BigEndianShort                     polyphony;                    /* Maximum number of voices */
  1149.     BigEndianFixed                     typicalPolyphony;            /* Hint for level mixing */
  1150. };
  1151. typedef struct NoteRequestInfo            NoteRequestInfo;
  1152.  
  1153. struct NoteRequest {
  1154.     NoteRequestInfo                 info;
  1155.     ToneDescription                 tone;
  1156. };
  1157. typedef struct NoteRequest                NoteRequest;
  1158. typedef struct OpaqueNoteChannel*         NoteChannel;
  1159.  
  1160.  
  1161. enum {
  1162.     kPickDontMix                = 1,                            /* dont mix instruments with drum sounds */
  1163.     kPickSameSynth                = 2,                            /* only allow the same device that went in, to come out */
  1164.     kPickUserInsts                = 4,                            /* show user insts in addition to ROM voices */
  1165.     kPickEditAllowEdit            = 8,                            /* lets user switch over to edit mode */
  1166.     kPickEditAllowPick            = 16,                            /* lets the user switch over to pick mode */
  1167.     kPickEditSynthGlobal        = 32,                            /* edit the global knobs of the synth */
  1168.     kPickEditControllers        = 64                            /* edit the controllers of the notechannel */
  1169. };
  1170.  
  1171.  
  1172. enum {
  1173.     kNoteAllocatorComponentType    = FOUR_CHAR_CODE('nota')
  1174. };
  1175.  
  1176.  
  1177. /*--------------------------------
  1178.     Note Allocator Prototypes
  1179. --------------------------------*/
  1180. EXTERN_API( ComponentResult )
  1181. NARegisterMusicDevice            (NoteAllocator             na,
  1182.                                  OSType                 synthType,
  1183.                                  Str31                     name,
  1184.                                  SynthesizerConnections * connections)                        FIVEWORDINLINE(0x2F3C, 0x000C, 0x0000, 0x7000, 0xA82A);
  1185.  
  1186. EXTERN_API( ComponentResult )
  1187. NAUnregisterMusicDevice            (NoteAllocator             na,
  1188.                                  long                     index)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0001, 0x7000, 0xA82A);
  1189.  
  1190. EXTERN_API( ComponentResult )
  1191. NAGetRegisteredMusicDevice        (NoteAllocator             na,
  1192.                                  long                     index,
  1193.                                  OSType *                synthType,
  1194.                                  Str31                     name,
  1195.                                  SynthesizerConnections * connections,
  1196.                                  MusicComponent *        mc)                                    FIVEWORDINLINE(0x2F3C, 0x0014, 0x0002, 0x7000, 0xA82A);
  1197.  
  1198. EXTERN_API( ComponentResult )
  1199. NASaveMusicConfiguration        (NoteAllocator             na)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0003, 0x7000, 0xA82A);
  1200.  
  1201. EXTERN_API( ComponentResult )
  1202. NANewNoteChannel                (NoteAllocator             na,
  1203.                                  NoteRequest *            noteRequest,
  1204.                                  NoteChannel *            outChannel)                            FIVEWORDINLINE(0x2F3C, 0x0008, 0x0004, 0x7000, 0xA82A);
  1205.  
  1206. EXTERN_API( ComponentResult )
  1207. NADisposeNoteChannel            (NoteAllocator             na,
  1208.                                  NoteChannel             noteChannel)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x0005, 0x7000, 0xA82A);
  1209.  
  1210. EXTERN_API( ComponentResult )
  1211. NAGetNoteChannelInfo            (NoteAllocator             na,
  1212.                                  NoteChannel             noteChannel,
  1213.                                  long *                    index,
  1214.                                  long *                    part)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x0006, 0x7000, 0xA82A);
  1215.  
  1216. EXTERN_API( ComponentResult )
  1217. NAPrerollNoteChannel            (NoteAllocator             na,
  1218.                                  NoteChannel             noteChannel)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x0007, 0x7000, 0xA82A);
  1219.  
  1220. EXTERN_API( ComponentResult )
  1221. NAUnrollNoteChannel                (NoteAllocator             na,
  1222.                                  NoteChannel             noteChannel)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x0008, 0x7000, 0xA82A);
  1223.  
  1224.  
  1225. EXTERN_API( ComponentResult )
  1226. NASetNoteChannelVolume            (NoteAllocator             na,
  1227.                                  NoteChannel             noteChannel,
  1228.                                  Fixed                     volume)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x000B, 0x7000, 0xA82A);
  1229.  
  1230. EXTERN_API( ComponentResult )
  1231. NAResetNoteChannel                (NoteAllocator             na,
  1232.                                  NoteChannel             noteChannel)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x000C, 0x7000, 0xA82A);
  1233.  
  1234. EXTERN_API( ComponentResult )
  1235. NAPlayNote                        (NoteAllocator             na,
  1236.                                  NoteChannel             noteChannel,
  1237.                                  long                     pitch,
  1238.                                  long                     velocity)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x000D, 0x7000, 0xA82A);
  1239.  
  1240. EXTERN_API( ComponentResult )
  1241. NASetController                    (NoteAllocator             na,
  1242.                                  NoteChannel             noteChannel,
  1243.                                  long                     controllerNumber,
  1244.                                  long                     controllerValue)                    FIVEWORDINLINE(0x2F3C, 0x000C, 0x000E, 0x7000, 0xA82A);
  1245.  
  1246. EXTERN_API( ComponentResult )
  1247. NASetKnob                        (NoteAllocator             na,
  1248.                                  NoteChannel             noteChannel,
  1249.                                  long                     knobNumber,
  1250.                                  long                     knobValue)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x000F, 0x7000, 0xA82A);
  1251.  
  1252. EXTERN_API( ComponentResult )
  1253. NAFindNoteChannelTone            (NoteAllocator             na,
  1254.                                  NoteChannel             noteChannel,
  1255.                                  ToneDescription *        td,
  1256.                                  long *                    instrumentNumber)                    FIVEWORDINLINE(0x2F3C, 0x000C, 0x0010, 0x7000, 0xA82A);
  1257.  
  1258. EXTERN_API( ComponentResult )
  1259. NASetInstrumentNumber            (NoteAllocator             na,
  1260.                                  NoteChannel             noteChannel,
  1261.                                  long                     instrumentNumber)                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0011, 0x7000, 0xA82A);
  1262.  
  1263.  
  1264.  
  1265. #if OLDROUTINENAMES
  1266. #define NASetNoteChannelInstrument(ci, noteChannel,instrumentNumber ) NASetInstrumentNumber(ci, noteChannel,instrumentNumber)
  1267. #define NASetInstrument(ci, noteChannel,instrumentNumber ) NASetInstrumentNumber(ci, noteChannel,instrumentNumber)
  1268. #endif
  1269. EXTERN_API( ComponentResult )
  1270. NAPickInstrument                (NoteAllocator             na,
  1271.                                  ModalFilterUPP         filterProc,
  1272.                                  StringPtr                 prompt,
  1273.                                  ToneDescription *        sd,
  1274.                                  unsigned long             flags,
  1275.                                  long                     refCon,
  1276.                                  long                     reserved1,
  1277.                                  long                     reserved2)                            FIVEWORDINLINE(0x2F3C, 0x001C, 0x0012, 0x7000, 0xA82A);
  1278.  
  1279. EXTERN_API( ComponentResult )
  1280. NAPickArrangement                (NoteAllocator             na,
  1281.                                  ModalFilterUPP         filterProc,
  1282.                                  StringPtr                 prompt,
  1283.                                  long                     zero1,
  1284.                                  long                     zero2,
  1285.                                  Track                     t,
  1286.                                  StringPtr                 songName)                            FIVEWORDINLINE(0x2F3C, 0x0018, 0x0013, 0x7000, 0xA82A);
  1287.  
  1288.  
  1289. EXTERN_API( ComponentResult )
  1290. NASetDefaultMIDIInput            (NoteAllocator             na,
  1291.                                  SynthesizerConnections * sc)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0015, 0x7000, 0xA82A);
  1292.  
  1293. EXTERN_API( ComponentResult )
  1294. NAGetDefaultMIDIInput            (NoteAllocator             na,
  1295.                                  SynthesizerConnections * sc)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0016, 0x7000, 0xA82A);
  1296.  
  1297.  
  1298. EXTERN_API( ComponentResult )
  1299. NAUseDefaultMIDIInput            (NoteAllocator             na,
  1300.                                  MusicMIDIReadHookUPP     readHook,
  1301.                                  long                     refCon,
  1302.                                  unsigned long             flags)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x0019, 0x7000, 0xA82A);
  1303.  
  1304. EXTERN_API( ComponentResult )
  1305. NALoseDefaultMIDIInput            (NoteAllocator             na)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x001A, 0x7000, 0xA82A);
  1306.  
  1307. EXTERN_API( ComponentResult )
  1308. NAStuffToneDescription            (NoteAllocator             na,
  1309.                                  long                     gmNumber,
  1310.                                  ToneDescription *        td)                                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x001B, 0x7000, 0xA82A);
  1311.  
  1312. EXTERN_API( ComponentResult )
  1313. NACopyrightDialog                (NoteAllocator             na,
  1314.                                  PicHandle                 p,
  1315.                                  StringPtr                 author,
  1316.                                  StringPtr                 copyright,
  1317.                                  StringPtr                 other,
  1318.                                  StringPtr                 title,
  1319.                                  ModalFilterUPP         filterProc,
  1320.                                  long                     refCon)                                FIVEWORDINLINE(0x2F3C, 0x001C, 0x001C, 0x7000, 0xA82A);
  1321.  
  1322.  
  1323. /*
  1324.       kNADummyOneSelect = 29
  1325.       kNADummyTwoSelect = 30
  1326. */
  1327.  
  1328. EXTERN_API( ComponentResult )
  1329. NAGetIndNoteChannel                (NoteAllocator             na,
  1330.                                  long                     index,
  1331.                                  NoteChannel *            nc,
  1332.                                  long *                    seed)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x001F, 0x7000, 0xA82A);
  1333.  
  1334.  
  1335. EXTERN_API( ComponentResult )
  1336. NAGetMIDIPorts                    (NoteAllocator             na,
  1337.                                  QTMIDIPortListHandle *    inputPorts,
  1338.                                  QTMIDIPortListHandle *    outputPorts)                        FIVEWORDINLINE(0x2F3C, 0x0008, 0x0021, 0x7000, 0xA82A);
  1339.  
  1340. EXTERN_API( ComponentResult )
  1341. NAGetNoteRequest                (NoteAllocator             na,
  1342.                                  NoteChannel             noteChannel,
  1343.                                  NoteRequest *            nrOut)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x0022, 0x7000, 0xA82A);
  1344.  
  1345. EXTERN_API( ComponentResult )
  1346. NASendMIDI                        (NoteAllocator             na,
  1347.                                  NoteChannel             noteChannel,
  1348.                                  MusicMIDIPacket *        mp)                                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0023, 0x7000, 0xA82A);
  1349.  
  1350. EXTERN_API( ComponentResult )
  1351. NAPickEditInstrument            (NoteAllocator             na,
  1352.                                  ModalFilterUPP         filterProc,
  1353.                                  StringPtr                 prompt,
  1354.                                  long                     refCon,
  1355.                                  NoteChannel             nc,
  1356.                                  AtomicInstrument         ai,
  1357.                                  long                     flags)                                FIVEWORDINLINE(0x2F3C, 0x0018, 0x0024, 0x7000, 0xA82A);
  1358.  
  1359. EXTERN_API( ComponentResult )
  1360. NANewNoteChannelFromAtomicInstrument (NoteAllocator     na,
  1361.                                  AtomicInstrumentPtr     instrument,
  1362.                                  long                     flags,
  1363.                                  NoteChannel *            outChannel)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0025, 0x7000, 0xA82A);
  1364.  
  1365. EXTERN_API( ComponentResult )
  1366. NASetAtomicInstrument            (NoteAllocator             na,
  1367.                                  NoteChannel             noteChannel,
  1368.                                  AtomicInstrumentPtr     instrument,
  1369.                                  long                     flags)                                FIVEWORDINLINE(0x2F3C, 0x000C, 0x0026, 0x7000, 0xA82A);
  1370.  
  1371.  
  1372.  
  1373. EXTERN_API( ComponentResult )
  1374. NAGetKnob                        (NoteAllocator             na,
  1375.                                  NoteChannel             noteChannel,
  1376.                                  long                     knobNumber,
  1377.                                  long *                    knobValue)                            FIVEWORDINLINE(0x2F3C, 0x000C, 0x0028, 0x7000, 0xA82A);
  1378.  
  1379. EXTERN_API( ComponentResult )
  1380. NATask                            (NoteAllocator             na)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0029, 0x7000, 0xA82A);
  1381.  
  1382. EXTERN_API( ComponentResult )
  1383. NASetNoteChannelBalance            (NoteAllocator             na,
  1384.                                  NoteChannel             noteChannel,
  1385.                                  long                     balance)                            FIVEWORDINLINE(0x2F3C, 0x0008, 0x002A, 0x7000, 0xA82A);
  1386.  
  1387. EXTERN_API( ComponentResult )
  1388. NASetInstrumentNumberInterruptSafe (NoteAllocator         na,
  1389.                                  NoteChannel             noteChannel,
  1390.                                  long                     instrumentNumber)                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x002B, 0x7000, 0xA82A);
  1391.  
  1392. EXTERN_API( ComponentResult )
  1393. NASetNoteChannelSoundLocalization (NoteAllocator         na,
  1394.                                  NoteChannel             noteChannel,
  1395.                                  Handle                 data)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x002C, 0x7000, 0xA82A);
  1396.  
  1397. EXTERN_API( ComponentResult )
  1398. NAGetController                    (NoteAllocator             na,
  1399.                                  NoteChannel             noteChannel,
  1400.                                  long                     controllerNumber,
  1401.                                  long *                    controllerValue)                    FIVEWORDINLINE(0x2F3C, 0x000C, 0x002D, 0x7000, 0xA82A);
  1402.  
  1403.  
  1404.  
  1405.  
  1406.  
  1407. enum {
  1408.     kTuneQueueDepth                = 8                                /* Deepest you can queue tune segments */
  1409. };
  1410.  
  1411.  
  1412.  
  1413. struct TuneStatus {
  1414.     unsigned long *                    tune;                        /* currently playing tune */
  1415.     unsigned long *                    tunePtr;                    /* position within currently playing piece */
  1416.     TimeValue                         time;                        /* current tune time */
  1417.     short                             queueCount;                    /* how many pieces queued up? */
  1418.     short                             queueSpots;                    /* How many more tunepieces can be queued */
  1419.     TimeValue                         queueTime;                    /* How much time is queued up? (can be very inaccurate) */
  1420.     long                             reserved[3];
  1421. };
  1422. typedef struct TuneStatus                TuneStatus;
  1423. typedef CALLBACK_API( void , TuneCallBackProcPtr )(const TuneStatus *status, long refCon);
  1424. typedef CALLBACK_API( void , TunePlayCallBackProcPtr )(unsigned long *event, long seed, long refCon);
  1425. typedef STACK_UPP_TYPE(TuneCallBackProcPtr)                     TuneCallBackUPP;
  1426. typedef STACK_UPP_TYPE(TunePlayCallBackProcPtr)                 TunePlayCallBackUPP;
  1427.  
  1428. typedef ComponentInstance                 TunePlayer;
  1429. enum {
  1430.     kTunePlayerComponentType    = FOUR_CHAR_CODE('tune')
  1431. };
  1432.  
  1433.  
  1434. EXTERN_API( ComponentResult )
  1435. TuneSetHeader                    (TunePlayer             tp,
  1436.                                  unsigned long *        header)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0004, 0x7000, 0xA82A);
  1437.  
  1438. EXTERN_API( ComponentResult )
  1439. TuneGetTimeBase                    (TunePlayer             tp,
  1440.                                  TimeBase *                tb)                                    FIVEWORDINLINE(0x2F3C, 0x0004, 0x0005, 0x7000, 0xA82A);
  1441.  
  1442. EXTERN_API( ComponentResult )
  1443. TuneSetTimeScale                (TunePlayer             tp,
  1444.                                  TimeScale                 scale)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0006, 0x7000, 0xA82A);
  1445.  
  1446. EXTERN_API( ComponentResult )
  1447. TuneGetTimeScale                (TunePlayer             tp,
  1448.                                  TimeScale *            scale)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0007, 0x7000, 0xA82A);
  1449.  
  1450. EXTERN_API( ComponentResult )
  1451. TuneGetIndexedNoteChannel        (TunePlayer             tp,
  1452.                                  long                     i,
  1453.                                  NoteChannel *            nc)                                    FIVEWORDINLINE(0x2F3C, 0x0008, 0x0008, 0x7000, 0xA82A);
  1454.  
  1455.  
  1456. /* Values for when to start. */
  1457. enum {
  1458.     kTuneStartNow                = 1,                            /* start after buffer is implied */
  1459.     kTuneDontClipNotes            = 2,                            /* allow notes to finish their durations outside sample */
  1460.     kTuneExcludeEdgeNotes        = 4,                            /* dont play notes that start at end of tune */
  1461.     kTuneQuickStart                = 8,                            /* Leave all the controllers where they are, ignore start time */
  1462.     kTuneLoopUntil                = 16,                            /* loop a queued tune if there's nothing else in the queue*/
  1463.     kTunePlayDifference            = 32,                            /* by default, the tune difference is skipped*/
  1464.     kTunePlayConcurrent            = 64,                            /* dont block the next tune sequence with this one*/
  1465.     kTuneStartNewMaster            = 16384
  1466. };
  1467.  
  1468. EXTERN_API( ComponentResult )
  1469. TuneQueue                        (TunePlayer             tp,
  1470.                                  unsigned long *        tune,
  1471.                                  Fixed                     tuneRate,
  1472.                                  unsigned long             tuneStartPosition,
  1473.                                  unsigned long             tuneStopPosition,
  1474.                                  unsigned long             queueFlags,
  1475.                                  TuneCallBackUPP         callBackProc,
  1476.                                  long                     refCon)                                FIVEWORDINLINE(0x2F3C, 0x001C, 0x000A, 0x7000, 0xA82A);
  1477.  
  1478. EXTERN_API( ComponentResult )
  1479. TuneInstant                        (TunePlayer             tp,
  1480.                                  unsigned long *        tune,
  1481.                                  unsigned long             tunePosition)                        FIVEWORDINLINE(0x2F3C, 0x0008, 0x000B, 0x7000, 0xA82A);
  1482.  
  1483. EXTERN_API( ComponentResult )
  1484. TuneGetStatus                    (TunePlayer             tp,
  1485.                                  TuneStatus *            status)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x000C, 0x7000, 0xA82A);
  1486.  
  1487. /* Values for stopping. */
  1488. enum {
  1489.     kTuneStopFade                = 1,                            /* do a quick, synchronous fadeout */
  1490.     kTuneStopSustain            = 2,                            /* don't silece notes */
  1491.     kTuneStopInstant            = 4,                            /* silence notes fast (else, decay them) */
  1492.     kTuneStopReleaseChannels    = 8                                /* afterwards, let the channels go */
  1493. };
  1494.  
  1495. EXTERN_API( ComponentResult )
  1496. TuneStop                        (TunePlayer             tp,
  1497.                                  long                     stopFlags)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x000D, 0x7000, 0xA82A);
  1498.  
  1499.  
  1500. EXTERN_API( ComponentResult )
  1501. TuneSetVolume                    (TunePlayer             tp,
  1502.                                  Fixed                     volume)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0010, 0x7000, 0xA82A);
  1503.  
  1504. EXTERN_API( ComponentResult )
  1505. TuneGetVolume                    (TunePlayer             tp)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0011, 0x7000, 0xA82A);
  1506.  
  1507. EXTERN_API( ComponentResult )
  1508. TunePreroll                        (TunePlayer             tp)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0012, 0x7000, 0xA82A);
  1509.  
  1510. EXTERN_API( ComponentResult )
  1511. TuneUnroll                        (TunePlayer             tp)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0013, 0x7000, 0xA82A);
  1512.  
  1513. EXTERN_API( ComponentResult )
  1514. TuneSetNoteChannels                (TunePlayer             tp,
  1515.                                  unsigned long             count,
  1516.                                  NoteChannel *            noteChannelList,
  1517.                                  TunePlayCallBackUPP     playCallBackProc,
  1518.                                  long                     refCon)                                FIVEWORDINLINE(0x2F3C, 0x0010, 0x0014, 0x7000, 0xA82A);
  1519.  
  1520. EXTERN_API( ComponentResult )
  1521. TuneSetPartTranspose            (TunePlayer             tp,
  1522.                                  unsigned long             part,
  1523.                                  long                     transpose,
  1524.                                  long                     velocityShift)                        FIVEWORDINLINE(0x2F3C, 0x000C, 0x0015, 0x7000, 0xA82A);
  1525.  
  1526.  
  1527. EXTERN_API( NoteAllocator )
  1528. TuneGetNoteAllocator            (TunePlayer             tp)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0017, 0x7000, 0xA82A);
  1529.  
  1530. EXTERN_API( ComponentResult )
  1531. TuneSetSofter                    (TunePlayer             tp,
  1532.                                  long                     softer)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x0018, 0x7000, 0xA82A);
  1533.  
  1534. EXTERN_API( ComponentResult )
  1535. TuneTask                        (TunePlayer             tp)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0019, 0x7000, 0xA82A);
  1536.  
  1537. EXTERN_API( ComponentResult )
  1538. TuneSetBalance                    (TunePlayer             tp,
  1539.                                  long                     balance)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x001A, 0x7000, 0xA82A);
  1540.  
  1541. EXTERN_API( ComponentResult )
  1542. TuneSetSoundLocalization        (TunePlayer             tp,
  1543.                                  Handle                 data)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0x001B, 0x7000, 0xA82A);
  1544.  
  1545. EXTERN_API( ComponentResult )
  1546. TuneSetHeaderWithSize            (TunePlayer             tp,
  1547.                                  unsigned long *        header,
  1548.                                  unsigned long             size)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x001C, 0x7000, 0xA82A);
  1549.  
  1550. /* flags for part mix. */
  1551. enum {
  1552.     kTuneMixMute                = 1,                            /* disable a part */
  1553.     kTuneMixSolo                = 2                                /* if any parts soloed, play only soloed parts */
  1554. };
  1555.  
  1556.  
  1557. EXTERN_API( ComponentResult )
  1558. TuneSetPartMix                    (TunePlayer             tp,
  1559.                                  unsigned long             partNumber,
  1560.                                  long                     volume,
  1561.                                  long                     balance,
  1562.                                  long                     mixFlags)                            FIVEWORDINLINE(0x2F3C, 0x0010, 0x001D, 0x7000, 0xA82A);
  1563.  
  1564. EXTERN_API( ComponentResult )
  1565. TuneGetPartMix                    (TunePlayer             tp,
  1566.                                  unsigned long             partNumber,
  1567.                                  long *                    volumeOut,
  1568.                                  long *                    balanceOut,
  1569.                                  long *                    mixFlagsOut)                        FIVEWORDINLINE(0x2F3C, 0x0010, 0x001E, 0x7000, 0xA82A);
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575. typedef unsigned long                     MusicOpWord;
  1576. typedef MusicOpWord *                    MusicOpWordPtr;
  1577. /*     QuickTime Music Track Event Formats:
  1578.  
  1579.     At this time, QuickTime music tracks support 5 different event types -- REST events,
  1580.     short NOTE events, short CONTROL events, short GENERAL events, Long NOTE events, 
  1581.     long CONTROL events, and variable GENERAL events.
  1582.  
  1583.         o REST Event (4 bytes/event):
  1584.     
  1585.             (0 0 0) (5-bit UNUSED) (24-bit Rest Duration)
  1586.         
  1587.         o.Short NOTE Events (4 bytes/event):
  1588.     
  1589.             (0 0 1) (5-bit Part) (6-bit Pitch) (7-bit Volume) (11-bit Duration)
  1590.         
  1591.             where:    Pitch is offset by 32 (Actual pitch = pitch field + 32)
  1592.  
  1593.         o.Short CONTROL Events (4 bytes/event):
  1594.     
  1595.             (0 1 0) (5-bit Part) (8-bit Controller) (1-bit UNUSED) (1-bit Sign) (7-bit MSB) (7-bit LSB)
  1596.                                                                          ( or 15-bit Signed Value)
  1597.         o Short GENERAL Event (4 bytes/event):
  1598.     
  1599.             (0 1 1) (1-bit UNUSED) (12-bit Sub-Type) (16-bit Value)
  1600.     
  1601.         o Long NOTE Events (8 bytes/event):
  1602.     
  1603.             (1 0 0 1) (12-bit Part) (1-bit UNUSED) (7-bit Pitch) (1-bit UNUSED) (7-bit Volume)
  1604.             (1 0) (8-bit UNUSED) (22-bit Duration)
  1605.         
  1606.         o.Long CONTROL Event (8 bytes/event):
  1607.         
  1608.             (1 0 1 0) (12-bit Part) (16-bit Value MSB) 
  1609.             (1 0) (14-bit Controller) (16-bit Value LSB)
  1610.     
  1611.         o.Long KNOB Event (8 bytes/event):
  1612.     
  1613.             (1 0 1 1) (12-bit Sub-Type) (16-bit Value MSB)
  1614.             (1 0) (14-bit KNOB) (16-bit Value LSB)
  1615.     
  1616.         o.Variable GENERAL Length Events (N bytes/event):
  1617.     
  1618.             (1 1 1 1) (12-bit Sub-Type) (16-bit Length)
  1619.                 :
  1620.             (32-bit Data values)
  1621.                 :
  1622.             (1 1) (14-bit UNUSED) (16-bit Length)
  1623.     
  1624.             where:    Length field is the number of LONG words in the record.
  1625.                     Lengths include the first and last long words (Minimum length = 2)
  1626.                 
  1627.     The following event type values have not been used yet and are reserved for 
  1628.     future expansion:
  1629.         
  1630.         o (1 0 0 0)        (8 bytes/event)
  1631.         o (1 1 0 0)        (N bytes/event)
  1632.         o (1 1 0 1)        (N bytes/event)
  1633.         o (1 1 1 0)        (N bytes/event)
  1634.         
  1635.     For all events, the following generalizations apply:
  1636.     
  1637.         -    All duration values are specified in Millisecond units.
  1638.         -     Pitch values are intended to map directly to the MIDI key numbers.
  1639.         -    Controllers from 0 to 127 correspond to the standard MIDI controllers.
  1640.             Controllers greater than 127 correspond to other controls (i.e., Pitch Bend, 
  1641.             Key Pressure, and Channel Pressure).    
  1642. */
  1643.  
  1644. /* Defines for the implemented music event data fields*/
  1645. enum {
  1646.     kRestEventType                = 0x00000000,                    /* lower 3-bits */
  1647.     kNoteEventType                = 0x00000001,                    /* lower 3-bits */
  1648.     kControlEventType            = 0x00000002,                    /* lower 3-bits */
  1649.     kMarkerEventType            = 0x00000003,                    /* lower 3-bits */
  1650.     kUndefined1EventType        = 0x00000008,                    /* 4-bits */
  1651.     kXNoteEventType                = 0x00000009,                    /* 4-bits */
  1652.     kXControlEventType            = 0x0000000A,                    /* 4-bits */
  1653.     kKnobEventType                = 0x0000000B,                    /* 4-bits */
  1654.     kUndefined2EventType        = 0x0000000C,                    /* 4-bits */
  1655.     kUndefined3EventType        = 0x0000000D,                    /* 4-bits */
  1656.     kUndefined4EventType        = 0x0000000E,                    /* 4-bits */
  1657.     kGeneralEventType            = 0x0000000F,                    /* 4-bits */
  1658.     kXEventLengthBits            = 0x00000002,                    /* 2 bits: indicates 8-byte event record */
  1659.     kGeneralEventLengthBits        = 0x00000003,                    /* 2 bits: indicates variable length event record */
  1660.     kEventLen                    = 1L,                            /* length of events in long words */
  1661.     kXEventLen                    = 2L,
  1662.     kRestEventLen                = kEventLen,                    /* length of events in long words */
  1663.     kNoteEventLen                = kEventLen,
  1664.     kControlEventLen            = kEventLen,
  1665.     kMarkerEventLen                = kEventLen,
  1666.     kXNoteEventLen                = kXEventLen,
  1667.     kXControlEventLen            = kXEventLen,
  1668.     kGeneralEventLen            = kXEventLen,                    /* 2 or more, however */
  1669.                                                                 /* Universal Event Defines*/
  1670.     kEventLengthFieldPos        = 30,                            /* by looking at these two bits of the 1st or last word              */
  1671.     kEventLengthFieldWidth        = 2,                            /* of an event you can determine the event length                      */
  1672.                                                                 /* length field: 0 & 1 => 1 long; 2 => 2 longs; 3 => variable length */
  1673.     kEventTypeFieldPos            = 29,                            /* event type field for short events */
  1674.     kEventTypeFieldWidth        = 3,                            /* short type is 3 bits */
  1675.     kXEventTypeFieldPos            = 28,                            /* event type field for extended events */
  1676.     kXEventTypeFieldWidth        = 4,                            /* extended type is 4 bits */
  1677.     kEventPartFieldPos            = 24,
  1678.     kEventPartFieldWidth        = 5,
  1679.     kXEventPartFieldPos            = 16,                            /* in the 1st long word */
  1680.     kXEventPartFieldWidth        = 12,                            /* Rest Events*/
  1681.     kRestEventDurationFieldPos    = 0,
  1682.     kRestEventDurationFieldWidth = 24,
  1683.     kRestEventDurationMax        = ((1L << kRestEventDurationFieldWidth) - 1), /* Note Events*/
  1684.     kNoteEventPitchFieldPos        = 18,
  1685.     kNoteEventPitchFieldWidth    = 6,
  1686.     kNoteEventPitchOffset        = 32,                            /* add to value in pitch field to get actual pitch */
  1687.     kNoteEventVolumeFieldPos    = 11,
  1688.     kNoteEventVolumeFieldWidth    = 7,
  1689.     kNoteEventVolumeOffset        = 0,                            /* add to value in volume field to get actual volume */
  1690.     kNoteEventDurationFieldPos    = 0,
  1691.     kNoteEventDurationFieldWidth = 11,
  1692.     kNoteEventDurationMax        = ((1L << kNoteEventDurationFieldWidth) - 1),
  1693.     kXNoteEventPitchFieldPos    = 0,                            /* in the 1st long word */
  1694.     kXNoteEventPitchFieldWidth    = 16,
  1695.     kXNoteEventDurationFieldPos    = 0,                            /* in the 2nd long word */
  1696.     kXNoteEventDurationFieldWidth = 22,
  1697.     kXNoteEventDurationMax        = ((1L << kXNoteEventDurationFieldWidth) - 1),
  1698.     kXNoteEventVolumeFieldPos    = 22,                            /* in the 2nd long word */
  1699.     kXNoteEventVolumeFieldWidth    = 7,                            /* Control Events*/
  1700.     kControlEventControllerFieldPos = 16,
  1701.     kControlEventControllerFieldWidth = 8,
  1702.     kControlEventValueFieldPos    = 0,
  1703.     kControlEventValueFieldWidth = 16,
  1704.     kXControlEventControllerFieldPos = 0,                        /* in the 2nd long word */
  1705.     kXControlEventControllerFieldWidth = 16,
  1706.     kXControlEventValueFieldPos    = 0,                            /* in the 1st long word */
  1707.     kXControlEventValueFieldWidth = 16,                            /* Knob Events*/
  1708.     kKnobEventValueHighFieldPos    = 0,                            /* 1st long word */
  1709.     kKnobEventValueHighFieldWidth = 16,
  1710.     kKnobEventKnobFieldPos        = 16,                            /* 2nd long word */
  1711.     kKnobEventKnobFieldWidth    = 14,
  1712.     kKnobEventValueLowFieldPos    = 0,                            /* 2nd long word */
  1713.     kKnobEventValueLowFieldWidth = 16,                            /* Marker Events*/
  1714.     kMarkerEventSubtypeFieldPos    = 16,
  1715.     kMarkerEventSubtypeFieldWidth = 8,
  1716.     kMarkerEventValueFieldPos    = 0,
  1717.     kMarkerEventValueFieldWidth    = 16,                            /* General Events*/
  1718.     kGeneralEventSubtypeFieldPos = 16,                            /* in the last long word */
  1719.     kGeneralEventSubtypeFieldWidth = 14,
  1720.     kGeneralEventLengthFieldPos    = 0,                            /* in the 1st & last long words */
  1721.     kGeneralEventLengthFieldWidth = 16
  1722. };
  1723.  
  1724. #if TARGET_RT_LITTLE_ENDIAN
  1725. enum {
  1726.     kEndMarkerValue                = 0x00000060
  1727. };
  1728.  
  1729. #else
  1730. enum {
  1731.     kEndMarkerValue                = 0x60000000
  1732. };
  1733.  
  1734. #endif  /* TARGET_RT_LITTLE_ENDIAN */
  1735.  
  1736. /* macros for extracting various fields from the QuickTime event records*/
  1737.  
  1738. #define qtma_MASK(bitWidth)             ((1L << (bitWidth)) - 1)
  1739. #define qtma_EXT(val, pos, width)         ((EndianU32_BtoN(val) >> (pos)) & qtma_MASK(width))
  1740. #define qtma_EventLengthForward(xP,ulen)        \
  1741.     {                                            \
  1742.         unsigned long _ext;                            \
  1743.         unsigned long *lP = (unsigned long *)(xP);    \
  1744.         _ext = qtma_EXT(*lP, kEventLengthFieldPos, kEventLengthFieldWidth); \
  1745.         if (_ext != 3) {                        \
  1746.             ulen = (_ext < 2) ? 1 : 2;            \
  1747.         } else {                                \
  1748.             ulen = (unsigned short)qtma_EXT(*lP, kGeneralEventLengthFieldPos, kGeneralEventLengthFieldWidth); \
  1749.             if (ulen < 2) {                        \
  1750.                 ulen = lP[1];                    \
  1751.             }                                    \
  1752.         }                                        \
  1753.     }
  1754. #define qtma_EventLengthBackward(xP,ulen)        \
  1755.     {                                            \
  1756.         unsigned long _ext;                        \
  1757.         unsigned long *lP = (unsigned long *)(xP); \
  1758.         _ext = qtma_EXT(*lP, kEventLengthFieldPos, kEventLengthFieldWidth);        \
  1759.         if (_ext != 3) {                        \
  1760.             ulen = (_ext < 2) ? 1 : 2;            \
  1761.         } else {                                \
  1762.             ulen = (unsigned short)qtma_EXT(*lP, kGeneralEventLengthFieldPos, kGeneralEventLengthFieldWidth);        \
  1763.             if (ulen < 2) {                        \
  1764.                 ulen = lP[-1];                    \
  1765.             }                                    \
  1766.         }                                        \
  1767.     }
  1768. #define qtma_EventType(x)                 ((qtma_EXT(x, kEventTypeFieldPos, kEventTypeFieldWidth) > 3) ? qtma_EXT(x, kXEventTypeFieldPos, kXEventTypeFieldWidth) : qtma_EXT(x, kEventTypeFieldPos, kEventTypeFieldWidth))
  1769. #define qtma_RestDuration(x)              (qtma_EXT(x, kRestEventDurationFieldPos, kRestEventDurationFieldWidth))
  1770. #define qtma_Part(x)                     (qtma_EXT(x, kEventPartFieldPos, kEventPartFieldWidth))
  1771. #define qtma_XPart(m, l)                 (qtma_EXT(m, kXEventPartFieldPos, kXEventPartFieldWidth))
  1772. #define qtma_NotePitch(x)                 (qtma_EXT(x, kNoteEventPitchFieldPos, kNoteEventPitchFieldWidth) + kNoteEventPitchOffset)
  1773. #define qtma_NoteVolume(x)                 (qtma_EXT(x, kNoteEventVolumeFieldPos, kNoteEventVolumeFieldWidth) + kNoteEventVolumeOffset)
  1774. #define qtma_NoteDuration(x)             (qtma_EXT(x, kNoteEventDurationFieldPos, kNoteEventDurationFieldWidth))
  1775. #define qtma_NoteVelocity qtma_NoteVolume
  1776. #define qtma_XNotePitch(m, l)             (qtma_EXT(m, kXNoteEventPitchFieldPos, kXNoteEventPitchFieldWidth))
  1777. #define qtma_XNoteVolume(m, l)             (qtma_EXT(l, kXNoteEventVolumeFieldPos, kXNoteEventVolumeFieldWidth))
  1778. #define qtma_XNoteDuration(m, l)         (qtma_EXT(l, kXNoteEventDurationFieldPos, kXNoteEventDurationFieldWidth))
  1779. #define qtma_XNoteVelocity qtma_XNoteVolume
  1780. #define qtma_ControlController(x)         (qtma_EXT(x, kControlEventControllerFieldPos, kControlEventControllerFieldWidth))
  1781. #define qtma_ControlValue(x)             (qtma_EXT(x, kControlEventValueFieldPos, kControlEventValueFieldWidth))
  1782. #define qtma_XControlController(m, l)     (qtma_EXT(l, kXControlEventControllerFieldPos, kXControlEventControllerFieldWidth))
  1783. #define qtma_XControlValue(m, l)         (qtma_EXT(m, kXControlEventValueFieldPos, kXControlEventValueFieldWidth))
  1784. #define qtma_MarkerSubtype(x)            (qtma_EXT(x,kMarkerEventSubtypeFieldPos,kMarkerEventSubtypeFieldWidth))
  1785. #define qtma_MarkerValue(x)             (qtma_EXT(x, kMarkerEventValueFieldPos, kMarkerEventValueFieldWidth))
  1786.  
  1787. #define qtma_KnobValue(m,l)                ((qtma_EXT(m,kKnobEventValueHighFieldPos,kKnobEventValueHighFieldWidth) << 16)    \
  1788.                                         | (qtma_EXT(l,kKnobEventValueLowFieldPos,kKnobEventValueLowFieldWidth)))
  1789.  
  1790. #define qtma_KnobKnob(m,l)                (qtma_EXT(l,kKnobEventKnobFieldPos,kKnobEventKnobFieldWidth))
  1791. #define qtma_GeneralSubtype(m,l)        (qtma_EXT(l,kGeneralEventSubtypeFieldPos,kGeneralEventSubtypeFieldWidth))
  1792. #define qtma_GeneralLength(m,l)           (qtma_EXT(m,kGeneralEventLengthFieldPos,kGeneralEventLengthFieldWidth))
  1793. #define qtma_StuffRestEvent(x, duration) ( \
  1794.     x =       (kRestEventType << kEventTypeFieldPos)    \
  1795.         |  ((long)(duration) << kRestEventDurationFieldPos),    \
  1796.     x = EndianU32_NtoB(x) )
  1797. #define qtma_StuffNoteEvent(x, part, pitch, volume, duration) ( \
  1798.     x =        (kNoteEventType << kEventTypeFieldPos)    \
  1799.         |     ((long)(part) << kEventPartFieldPos)    \
  1800.         |    (((long)(pitch) - kNoteEventPitchOffset) << kNoteEventPitchFieldPos)    \
  1801.         |    (((long)(volume) - kNoteEventVolumeOffset) << kNoteEventVolumeFieldPos)    \
  1802.         |    ((long)(duration) << kNoteEventDurationFieldPos), \
  1803.     x = EndianU32_NtoB(x) )
  1804. #define qtma_StuffControlEvent(x, part, control, value) ( \
  1805.     x =        (kControlEventType << kEventTypeFieldPos)            \
  1806.         |     ((long)(part) << kEventPartFieldPos)                \
  1807.         |    ((long)(control) << kControlEventControllerFieldPos)\
  1808.         |    ((long)((value) & qtma_MASK(kControlEventValueFieldWidth)) << kControlEventValueFieldPos), \
  1809.     x = EndianU32_NtoB(x) )
  1810. #define qtma_StuffMarkerEvent(x, markerType, markerValue) ( \
  1811.     x =     (kMarkerEventType << kEventTypeFieldPos)    \
  1812.         |     ((long)(markerType) << kMarkerEventSubtypeFieldPos)    \
  1813.         |    ((long)(markerValue) << kMarkerEventValueFieldPos), \
  1814.     x = EndianU32_NtoB(x) )
  1815. #define qtma_StuffXNoteEvent(w1, w2, part, pitch, volume, duration) ( \
  1816.     w1 =     (kXNoteEventType << kXEventTypeFieldPos)            \
  1817.         |    ((long)(part) << kXEventPartFieldPos)                \
  1818.         |    ((long)(pitch) << kXNoteEventPitchFieldPos),        \
  1819.     w1 = EndianU32_NtoB(w1),                                    \
  1820.     w2 =     (kXEventLengthBits << kEventLengthFieldPos)        \
  1821.         |    ((long)(duration) << kXNoteEventDurationFieldPos)    \
  1822.         |    ((long)(volume) << kXNoteEventVolumeFieldPos),        \
  1823.     w2 = EndianU32_NtoB(w2) )
  1824. #define qtma_StuffXControlEvent(w1, w2, part, control, value) (        \
  1825.     w1 =     (kXControlEventType << kXEventTypeFieldPos)                \
  1826.         |    ((long)(part) << kXEventPartFieldPos)                    \
  1827.         |    ((long)((value) & qtma_MASK(kXControlEventValueFieldWidth)) << kXControlEventValueFieldPos), \
  1828.     w1 = EndianU32_NtoB(w1),                                        \
  1829.     w2 =     (kXEventLengthBits << kEventLengthFieldPos)                \
  1830.         |    ((long)(control) << kXControlEventControllerFieldPos),    \
  1831.     w2 = EndianU32_NtoB(w2) )
  1832. #define qtma_StuffKnobEvent(w1, w2, part, knob, value) ( \
  1833.     w1 =     (kKnobEventType << kXEventTypeFieldPos)                    \
  1834.         |    ((long)(part) << kXEventPartFieldPos)                    \
  1835.         |    ((long)(value >> 16) << kKnobEventValueLowFieldPos),    \
  1836.     w1 = EndianU32_NtoB(w1),                                        \
  1837.     w2 =     (kXEventLengthBits << kEventLengthFieldPos)                \
  1838.         |    ((long)(knob) << kKnobEventKnobFieldPos)                \
  1839.         |    ((long)(value & 0xFFFF) << kKnobEventValueLowFieldPos), \
  1840.     w2 = EndianU32_NtoB(w2) )
  1841. #define qtma_StuffGeneralEvent(w1,w2,part,subType,length) ( \
  1842.     w1 =    (kGeneralEventType << kXEventTypeFieldPos)                \
  1843.         |    ((long)(part) << kXEventPartFieldPos)                    \
  1844.         |    ((long)(length) << kGeneralEventLengthFieldPos),        \
  1845.     w1 = EndianU32_NtoB(w1),                                        \
  1846.     w2 = (kGeneralEventLengthBits << kEventLengthFieldPos)            \
  1847.         |    ((long)(subType) << kGeneralEventSubtypeFieldPos)        \
  1848.         |    ((long)(length) << kGeneralEventLengthFieldPos),        \
  1849.     w2 = EndianU32_NtoB(w2) )
  1850. #define qtma_NeedXGeneralEvent(length)     (((unsigned long)(length)) > (unsigned long)0xffff)
  1851.  
  1852. /* General Event Defined Types*/
  1853. enum {
  1854.     kGeneralEventNoteRequest    = 1,                            /* Encapsulates NoteRequest data structure */
  1855.     kGeneralEventPartKey        = 4,
  1856.     kGeneralEventTuneDifference    = 5,                            /* Contains a standard sequence, with end marker, for the tune difference of a sequence piece (halts QuickTime 2.0 Music) */
  1857.     kGeneralEventAtomicInstrument = 6,                            /* Encapsulates AtomicInstrument record */
  1858.     kGeneralEventKnob            = 7,                            /* knobID/knobValue pairs; smallest event is 4 longs */
  1859.     kGeneralEventMIDIChannel    = 8,                            /* used in tune header, one longword identifies the midi channel it originally came from */
  1860.     kGeneralEventPartChange        = 9,                            /* used in tune sequence, one longword identifies the tune part which can now take over this part's note channel (similar to program change) (halts QuickTime 2.0 Music)*/
  1861.     kGeneralEventNoOp            = 10,                            /* guaranteed to do nothing and be ignored. (halts QuickTime 2.0 Music) */
  1862.     kGeneralEventUsedNotes        = 11,                            /* four longwords specifying which midi notes are actually used, 0..127 msb to lsb */
  1863.     kGeneralEventPartMix        = 12                            /* three longwords: Fixed volume, long balance, long flags */
  1864. };
  1865.  
  1866. /* Marker Event Defined Types        // marker is 60 ee vv vv in hex, where e = event type, and v = value*/
  1867. enum {
  1868.     kMarkerEventEnd                = 0,                            /* marker type 0 means: value 0 - stop, value != 0 - ignore*/
  1869.     kMarkerEventBeat            = 1,                            /* value 0 = single beat; anything else is 65536ths-of-a-beat (quarter note)*/
  1870.     kMarkerEventTempo            = 2                                /* value same as beat marker, but indicates that a tempo event should be computed (based on where the next beat or tempo marker is) and emitted upon export*/
  1871. };
  1872.  
  1873. enum {
  1874.     kCurrentlyNativeEndian        = 1,
  1875.     kCurrentlyNotNativeEndian    = 2
  1876. };
  1877.  
  1878. /* UPP call backs */
  1879. #if OPAQUE_UPP_TYPES
  1880.     EXTERN_API(MusicMIDISendUPP)
  1881.     NewMusicMIDISendUPP               (MusicMIDISendProcPtr    userRoutine);
  1882.  
  1883.     EXTERN_API(MusicMIDIReadHookUPP)
  1884.     NewMusicMIDIReadHookUPP           (MusicMIDIReadHookProcPtr userRoutine);
  1885.  
  1886.     EXTERN_API(MusicOfflineDataUPP)
  1887.     NewMusicOfflineDataUPP           (MusicOfflineDataProcPtr    userRoutine);
  1888.  
  1889.     EXTERN_API(TuneCallBackUPP)
  1890.     NewTuneCallBackUPP               (TuneCallBackProcPtr        userRoutine);
  1891.  
  1892.     EXTERN_API(TunePlayCallBackUPP)
  1893.     NewTunePlayCallBackUPP           (TunePlayCallBackProcPtr    userRoutine);
  1894.  
  1895.     EXTERN_API(void)
  1896.     DisposeMusicMIDISendUPP           (MusicMIDISendUPP        userUPP);
  1897.  
  1898.     EXTERN_API(void)
  1899.     DisposeMusicMIDIReadHookUPP       (MusicMIDIReadHookUPP    userUPP);
  1900.  
  1901.     EXTERN_API(void)
  1902.     DisposeMusicOfflineDataUPP       (MusicOfflineDataUPP        userUPP);
  1903.  
  1904.     EXTERN_API(void)
  1905.     DisposeTuneCallBackUPP           (TuneCallBackUPP            userUPP);
  1906.  
  1907.     EXTERN_API(void)
  1908.     DisposeTunePlayCallBackUPP       (TunePlayCallBackUPP        userUPP);
  1909.  
  1910.     EXTERN_API(ComponentResult)
  1911.     InvokeMusicMIDISendUPP           (ComponentInstance        self,
  1912.                                     long                    refCon,
  1913.                                     MusicMIDIPacket *        mmp,
  1914.                                     MusicMIDISendUPP        userUPP);
  1915.  
  1916.     EXTERN_API(ComponentResult)
  1917.     InvokeMusicMIDIReadHookUPP       (MusicMIDIPacket *        mp,
  1918.                                     long                    myRefCon,
  1919.                                     MusicMIDIReadHookUPP    userUPP);
  1920.  
  1921.     EXTERN_API(ComponentResult)
  1922.     InvokeMusicOfflineDataUPP       (Ptr                        SoundData,
  1923.                                     long                    numBytes,
  1924.                                     long                    myRefCon,
  1925.                                     MusicOfflineDataUPP        userUPP);
  1926.  
  1927.     EXTERN_API(void)
  1928.     InvokeTuneCallBackUPP           (const TuneStatus *        status,
  1929.                                     long                    refCon,
  1930.                                     TuneCallBackUPP            userUPP);
  1931.  
  1932.     EXTERN_API(void)
  1933.     InvokeTunePlayCallBackUPP       (unsigned long *            event,
  1934.                                     long                    seed,
  1935.                                     long                    refCon,
  1936.                                     TunePlayCallBackUPP        userUPP);
  1937.  
  1938. #else
  1939.     enum { uppMusicMIDISendProcInfo = 0x00000FF0 };                 /* pascal 4_bytes Func(4_bytes, 4_bytes, 4_bytes) */
  1940.     enum { uppMusicMIDIReadHookProcInfo = 0x000003F0 };             /* pascal 4_bytes Func(4_bytes, 4_bytes) */
  1941.     enum { uppMusicOfflineDataProcInfo = 0x00000FF0 };                 /* pascal 4_bytes Func(4_bytes, 4_bytes, 4_bytes) */
  1942.     enum { uppTuneCallBackProcInfo = 0x000003C0 };                     /* pascal no_return_value Func(4_bytes, 4_bytes) */
  1943.     enum { uppTunePlayCallBackProcInfo = 0x00000FC0 };                 /* pascal no_return_value Func(4_bytes, 4_bytes, 4_bytes) */
  1944.     #define NewMusicMIDISendUPP(userRoutine)                         (MusicMIDISendUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMusicMIDISendProcInfo, GetCurrentArchitecture())
  1945.     #define NewMusicMIDIReadHookUPP(userRoutine)                     (MusicMIDIReadHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMusicMIDIReadHookProcInfo, GetCurrentArchitecture())
  1946.     #define NewMusicOfflineDataUPP(userRoutine)                     (MusicOfflineDataUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMusicOfflineDataProcInfo, GetCurrentArchitecture())
  1947.     #define NewTuneCallBackUPP(userRoutine)                         (TuneCallBackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTuneCallBackProcInfo, GetCurrentArchitecture())
  1948.     #define NewTunePlayCallBackUPP(userRoutine)                     (TunePlayCallBackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTunePlayCallBackProcInfo, GetCurrentArchitecture())
  1949.     #define DisposeMusicMIDISendUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  1950.     #define DisposeMusicMIDIReadHookUPP(userUPP)                     DisposeRoutineDescriptor(userUPP)
  1951.     #define DisposeMusicOfflineDataUPP(userUPP)                     DisposeRoutineDescriptor(userUPP)
  1952.     #define DisposeTuneCallBackUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  1953.     #define DisposeTunePlayCallBackUPP(userUPP)                     DisposeRoutineDescriptor(userUPP)
  1954.     #define InvokeMusicMIDISendUPP(self, refCon, mmp, userUPP)         (ComponentResult)CALL_THREE_PARAMETER_UPP((userUPP), uppMusicMIDISendProcInfo, (self), (refCon), (mmp))
  1955.     #define InvokeMusicMIDIReadHookUPP(mp, myRefCon, userUPP)         (ComponentResult)CALL_TWO_PARAMETER_UPP((userUPP), uppMusicMIDIReadHookProcInfo, (mp), (myRefCon))
  1956.     #define InvokeMusicOfflineDataUPP(SoundData, numBytes, myRefCon, userUPP)  (ComponentResult)CALL_THREE_PARAMETER_UPP((userUPP), uppMusicOfflineDataProcInfo, (SoundData), (numBytes), (myRefCon))
  1957.     #define InvokeTuneCallBackUPP(status, refCon, userUPP)             CALL_TWO_PARAMETER_UPP((userUPP), uppTuneCallBackProcInfo, (status), (refCon))
  1958.     #define InvokeTunePlayCallBackUPP(event, seed, refCon, userUPP)  CALL_THREE_PARAMETER_UPP((userUPP), uppTunePlayCallBackProcInfo, (event), (seed), (refCon))
  1959. #endif
  1960. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  1961. #define NewMusicMIDISendProc(userRoutine)                         NewMusicMIDISendUPP(userRoutine)
  1962. #define NewMusicMIDIReadHookProc(userRoutine)                     NewMusicMIDIReadHookUPP(userRoutine)
  1963. #define NewMusicOfflineDataProc(userRoutine)                     NewMusicOfflineDataUPP(userRoutine)
  1964. #define NewTuneCallBackProc(userRoutine)                         NewTuneCallBackUPP(userRoutine)
  1965. #define NewTunePlayCallBackProc(userRoutine)                     NewTunePlayCallBackUPP(userRoutine)
  1966. #define CallMusicMIDISendProc(userRoutine, self, refCon, mmp)    InvokeMusicMIDISendUPP(self, refCon, mmp, userRoutine)
  1967. #define CallMusicMIDIReadHookProc(userRoutine, mp, myRefCon)    InvokeMusicMIDIReadHookUPP(mp, myRefCon, userRoutine)
  1968. #define CallMusicOfflineDataProc(userRoutine, SoundData, numBytes, myRefCon) InvokeMusicOfflineDataUPP(SoundData, numBytes, myRefCon, userRoutine)
  1969. #define CallTuneCallBackProc(userRoutine, status, refCon)        InvokeTuneCallBackUPP(status, refCon, userRoutine)
  1970. #define CallTunePlayCallBackProc(userRoutine, event, seed, refCon) InvokeTunePlayCallBackUPP(event, seed, refCon, userRoutine)
  1971.  
  1972. /* selectors for component calls */
  1973. enum {
  1974.     kQTMIDIGetMIDIPortsSelect                        = 0x0001,
  1975.     kQTMIDIUseSendPortSelect                        = 0x0002,
  1976.     kQTMIDISendMIDISelect                            = 0x0003,
  1977.     kQTMIDIUseReceivePortSelect                        = 0x0004,
  1978.     kMusicGetDescriptionSelect                        = 0x0001,
  1979.     kMusicGetPartSelect                                = 0x0002,
  1980.     kMusicSetPartSelect                                = 0x0003,
  1981.     kMusicSetPartInstrumentNumberSelect                = 0x0004,
  1982.     kMusicGetPartInstrumentNumberSelect                = 0x0005,
  1983.     kMusicStorePartInstrumentSelect                    = 0x0006,
  1984.     kMusicGetPartAtomicInstrumentSelect                = 0x0009,
  1985.     kMusicSetPartAtomicInstrumentSelect                = 0x000A,
  1986.     kMusicGetInstrumentKnobDescriptionObsoleteSelect = 0x000D,
  1987.     kMusicGetDrumKnobDescriptionObsoleteSelect        = 0x000E,
  1988.     kMusicGetKnobDescriptionObsoleteSelect            = 0x000F,
  1989.     kMusicGetPartKnobSelect                            = 0x0010,
  1990.     kMusicSetPartKnobSelect                            = 0x0011,
  1991.     kMusicGetKnobSelect                                = 0x0012,
  1992.     kMusicSetKnobSelect                                = 0x0013,
  1993.     kMusicGetPartNameSelect                            = 0x0014,
  1994.     kMusicSetPartNameSelect                            = 0x0015,
  1995.     kMusicFindToneSelect                            = 0x0016,
  1996.     kMusicPlayNoteSelect                            = 0x0017,
  1997.     kMusicResetPartSelect                            = 0x0018,
  1998.     kMusicSetPartControllerSelect                    = 0x0019,
  1999.     kMusicGetPartControllerSelect                    = 0x001A,
  2000.     kMusicGetMIDIProcSelect                            = 0x001B,
  2001.     kMusicSetMIDIProcSelect                            = 0x001C,
  2002.     kMusicGetInstrumentNamesSelect                    = 0x001D,
  2003.     kMusicGetDrumNamesSelect                        = 0x001E,
  2004.     kMusicGetMasterTuneSelect                        = 0x001F,
  2005.     kMusicSetMasterTuneSelect                        = 0x0020,
  2006.     kMusicGetInstrumentAboutInfoSelect                = 0x0022,
  2007.     kMusicGetDeviceConnectionSelect                    = 0x0023,
  2008.     kMusicUseDeviceConnectionSelect                    = 0x0024,
  2009.     kMusicGetKnobSettingStringsSelect                = 0x0025,
  2010.     kMusicGetMIDIPortsSelect                        = 0x0026,
  2011.     kMusicSendMIDISelect                            = 0x0027,
  2012.     kMusicReceiveMIDISelect                            = 0x0028,
  2013.     kMusicStartOfflineSelect                        = 0x0029,
  2014.     kMusicSetOfflineTimeToSelect                    = 0x002A,
  2015.     kMusicGetInstrumentKnobDescriptionSelect        = 0x002B,
  2016.     kMusicGetDrumKnobDescriptionSelect                = 0x002C,
  2017.     kMusicGetKnobDescriptionSelect                    = 0x002D,
  2018.     kMusicGetInfoTextSelect                            = 0x002E,
  2019.     kMusicGetInstrumentInfoSelect                    = 0x002F,
  2020.     kMusicTaskSelect                                = 0x0031,
  2021.     kMusicSetPartInstrumentNumberInterruptSafeSelect = 0x0032,
  2022.     kMusicSetPartSoundLocalizationSelect            = 0x0033,
  2023.     kMusicGenericConfigureSelect                    = 0x0100,
  2024.     kMusicGenericGetPartSelect                        = 0x0101,
  2025.     kMusicGenericGetKnobListSelect                    = 0x0102,
  2026.     kMusicGenericSetResourceNumbersSelect            = 0x0103,
  2027.     kMusicDerivedMIDISendSelect                        = 0x0200,
  2028.     kMusicDerivedSetKnobSelect                        = 0x0201,
  2029.     kMusicDerivedSetPartSelect                        = 0x0202,
  2030.     kMusicDerivedSetInstrumentSelect                = 0x0203,
  2031.     kMusicDerivedSetPartInstrumentNumberSelect        = 0x0204,
  2032.     kMusicDerivedSetMIDISelect                        = 0x0205,
  2033.     kMusicDerivedStorePartInstrumentSelect            = 0x0206,
  2034.     kMusicDerivedOpenResFileSelect                    = 0x0207,
  2035.     kMusicDerivedCloseResFileSelect                    = 0x0208,
  2036.     kInstrumentGetInstSelect                        = 0x0001,
  2037.     kInstrumentGetInfoSelect                        = 0x0002,
  2038.     kInstrumentInitializeSelect                        = 0x0003,
  2039.     kInstrumentOpenComponentResFileSelect            = 0x0004,
  2040.     kInstrumentCloseComponentResFileSelect            = 0x0005,
  2041.     kInstrumentGetComponentRefConSelect                = 0x0006,
  2042.     kInstrumentSetComponentRefConSelect                = 0x0007,
  2043.     kInstrumentGetSynthesizerTypeSelect                = 0x0008,
  2044.     kNARegisterMusicDeviceSelect                    = 0x0000,
  2045.     kNAUnregisterMusicDeviceSelect                    = 0x0001,
  2046.     kNAGetRegisteredMusicDeviceSelect                = 0x0002,
  2047.     kNASaveMusicConfigurationSelect                    = 0x0003,
  2048.     kNANewNoteChannelSelect                            = 0x0004,
  2049.     kNADisposeNoteChannelSelect                        = 0x0005,
  2050.     kNAGetNoteChannelInfoSelect                        = 0x0006,
  2051.     kNAPrerollNoteChannelSelect                        = 0x0007,
  2052.     kNAUnrollNoteChannelSelect                        = 0x0008,
  2053.     kNASetNoteChannelVolumeSelect                    = 0x000B,
  2054.     kNAResetNoteChannelSelect                        = 0x000C,
  2055.     kNAPlayNoteSelect                                = 0x000D,
  2056.     kNASetControllerSelect                            = 0x000E,
  2057.     kNASetKnobSelect                                = 0x000F,
  2058.     kNAFindNoteChannelToneSelect                    = 0x0010,
  2059.     kNASetInstrumentNumberSelect                    = 0x0011,
  2060.     kNAPickInstrumentSelect                            = 0x0012,
  2061.     kNAPickArrangementSelect                        = 0x0013,
  2062.     kNASetDefaultMIDIInputSelect                    = 0x0015,
  2063.     kNAGetDefaultMIDIInputSelect                    = 0x0016,
  2064.     kNAUseDefaultMIDIInputSelect                    = 0x0019,
  2065.     kNALoseDefaultMIDIInputSelect                    = 0x001A,
  2066.     kNAStuffToneDescriptionSelect                    = 0x001B,
  2067.     kNACopyrightDialogSelect                        = 0x001C,
  2068.     kNAGetIndNoteChannelSelect                        = 0x001F,
  2069.     kNAGetMIDIPortsSelect                            = 0x0021,
  2070.     kNAGetNoteRequestSelect                            = 0x0022,
  2071.     kNASendMIDISelect                                = 0x0023,
  2072.     kNAPickEditInstrumentSelect                        = 0x0024,
  2073.     kNANewNoteChannelFromAtomicInstrumentSelect        = 0x0025,
  2074.     kNASetAtomicInstrumentSelect                    = 0x0026,
  2075.     kNAGetKnobSelect                                = 0x0028,
  2076.     kNATaskSelect                                    = 0x0029,
  2077.     kNASetNoteChannelBalanceSelect                    = 0x002A,
  2078.     kNASetInstrumentNumberInterruptSafeSelect        = 0x002B,
  2079.     kNASetNoteChannelSoundLocalizationSelect        = 0x002C,
  2080.     kNAGetControllerSelect                            = 0x002D,
  2081.     kTuneSetHeaderSelect                            = 0x0004,
  2082.     kTuneGetTimeBaseSelect                            = 0x0005,
  2083.     kTuneSetTimeScaleSelect                            = 0x0006,
  2084.     kTuneGetTimeScaleSelect                            = 0x0007,
  2085.     kTuneGetIndexedNoteChannelSelect                = 0x0008,
  2086.     kTuneQueueSelect                                = 0x000A,
  2087.     kTuneInstantSelect                                = 0x000B,
  2088.     kTuneGetStatusSelect                            = 0x000C,
  2089.     kTuneStopSelect                                    = 0x000D,
  2090.     kTuneSetVolumeSelect                            = 0x0010,
  2091.     kTuneGetVolumeSelect                            = 0x0011,
  2092.     kTunePrerollSelect                                = 0x0012,
  2093.     kTuneUnrollSelect                                = 0x0013,
  2094.     kTuneSetNoteChannelsSelect                        = 0x0014,
  2095.     kTuneSetPartTransposeSelect                        = 0x0015,
  2096.     kTuneGetNoteAllocatorSelect                        = 0x0017,
  2097.     kTuneSetSofterSelect                            = 0x0018,
  2098.     kTuneTaskSelect                                    = 0x0019,
  2099.     kTuneSetBalanceSelect                            = 0x001A,
  2100.     kTuneSetSoundLocalizationSelect                    = 0x001B,
  2101.     kTuneSetHeaderWithSizeSelect                    = 0x001C,
  2102.     kTuneSetPartMixSelect                            = 0x001D,
  2103.     kTuneGetPartMixSelect                            = 0x001E
  2104. };
  2105.  
  2106. #if PRAGMA_STRUCT_ALIGN
  2107.     #pragma options align=reset
  2108. #elif PRAGMA_STRUCT_PACKPUSH
  2109.     #pragma pack(pop)
  2110. #elif PRAGMA_STRUCT_PACK
  2111.     #pragma pack()
  2112. #endif
  2113.  
  2114. #ifdef PRAGMA_IMPORT_OFF
  2115. #pragma import off
  2116. #elif PRAGMA_IMPORT
  2117. #pragma import reset
  2118. #endif
  2119.  
  2120. #ifdef __cplusplus
  2121. }
  2122. #endif
  2123.  
  2124. #endif /* __QUICKTIMEMUSIC__ */
  2125.  
  2126.